diff --git a/content-script.js b/content-script.js index da47118..e2dbc85 100644 --- a/content-script.js +++ b/content-script.js @@ -301,7 +301,17 @@ if (!solution) { const codeElement = document.querySelector(SELECTORS.codeBlock) - solution = codeElement?.textContent || "" + lines = codeElement?.children + const code = Array.from(lines).map(line => { + // Get all child nodes of the line, but skip the first one (the line number) + // convert children to an array and slice from index 1 to the end + const codeParts = Array.from(line.childNodes).slice(1); + + // Join the remaining parts back together + return codeParts.map(part => part.textContent).join(''); + }).join('').replace(/\u00A0/g, ' '); + + solution = code || "" } else { solution = solution.replace(/\\n/g, "\n").replace(/ {2}/g, " ").replace(/"/g, "") }