Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion content-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -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, "")
}
Expand Down