Open janko opened 5 years ago
Thanks again @janko -
I'm using this package separately from Atom, for syntax highlighting code snippets in markdown files. I've noticed that when I switched from Highlight.js/Prism to Highlights, my page rendering performance reduced.
As I mentioned in https://github.com/atom/highlights/issues/69#issuecomment-545617638, can you confirm if this behavior causes a performance problem in Atom?
Not that I know of, I don't use Atom, I've only experienced it when using the library standalone.
Prerequisites
Description
I'm using this package separately from Atom, for syntax highlighting code snippets in markdown files. I've noticed that when I switched from Highlight.js/Prism to Highlights, my page rendering performance reduced.
This appears to be due to the number of
<span>
elements Highlights generates. In addition to the ones that haveclass
attributes with token names, there are also a lot of<span>
elements generated which don't have anyclass
attribute.When I tried stripping just the classless
<span>
tags, the rendering performance was now instant again.Steps to Reproduce
Expected behavior:
That highlighting produces only the tags that are necessary.
Actual behavior:
Highlighting produces many
<span>
tags that are not needed (the script above produces 4 such tags).Versions
Highlights 3.1.4