You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
letlines=html.split("\n").slice(0,-1);// The last line is empty.
It makes the assumption that the last entry in the array is always an empty string, but in my case that's not true. For me the last entry is "</span>". The slicing ignores that and thereby passes invalid HTML from here on.
Putting the slicing behind a check if the last line really is empty solves the problem for me.
letlines=html.split("\n");// Trim last line if it is emptyif(lines[lines.length-1]===""){lines=lines.slice(0,-1);}
I tried reproducing that with the test setup in this repository, but I was unable to do so. I can reproduce the error in a full eleventy setup though.
Noticed on my blog that every
diff
block generates unclosed<span>
-elements.I was able to trace the problem down to this particular line:
eleventy-plugin-syntaxhighlight/src/markdownSyntaxHighlightOptions.js
Line 28 in ac92151
It makes the assumption that the last entry in the array is always an empty string, but in my case that's not true. For me the last entry is
"</span>"
. The slicing ignores that and thereby passes invalid HTML from here on.Putting the slicing behind a check if the last line really is empty solves the problem for me.
I tried reproducing that with the test setup in this repository, but I was unable to do so. I can reproduce the error in a full eleventy setup though.
Git repo where the problem is reproducible: https://github.com/marvinhagemeister/eleventy-diff-syntax-highlight-bug
Steps to reproduce:
npm install
npm run build
dist/foo/index.html
contains invalid HTMLThe text was updated successfully, but these errors were encountered: