codePreviews: account for C in line selection (github)

This commit is contained in:
Cynthia Foxwell 2025-03-21 18:34:53 -06:00
parent 3289367e31
commit 7ef3c95533
Signed by: Cynosphere
SSH key fingerprint: SHA256:H3SM8ufP/uxqLwKSH7xY89TDnbR9uOHzjLoBr0tlajk

View file

@ -60,12 +60,12 @@ async function processFile(link, originalLink, spoiler = false, linkFile = false
fileName = `[${fileName}](<${originalLink}>)`; fileName = `[${fileName}](<${originalLink}>)`;
} }
const lineStr = urlObj.hash.match(/#L\d+(-L?\d+)?/)?.[0]; const lineStr = urlObj.hash.match(/#L\d+(C\d+)?(-L?\d+)?(C\d+)?/)?.[0];
let startLine, endLine; let startLine, endLine;
let entireFile = false; let entireFile = false;
if (lineStr) { if (lineStr) {
const [start, end] = lineStr.match(/\d+/g); const [start, end] = lineStr.match(/(?<=L-)\d+/g);
if (!end) { if (!end) {
startLine = endLine = start; startLine = endLine = start;
} else { } else {