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
When highlighting multi-line constructs, e.g. block comments or ES2015 template strings, highlight.js outputs a single <span> that contains newlines. For example:
varstring=` I am multiline`
Is converted to:
<spanclass="keyword">var</span> string = <spanclass="string">`
i am multilne
`</span>
<spanclass="line"><spanclass="keyword">var</span> string = <spanclass="string">`</span><br><spanclass="line"> i am multilne</span><br><spanclass="line">`</span></span><br>
In addition, it also creates a .line span that is in fact multiple lines high.
I personally use a custom theme that does not make use of the .line class at all, so I simply removed that wrapping span and everything works properly. However it seems many existing themes rely on the .line class for styling :(
The text was updated successfully, but these errors were encountered:
When highlighting multi-line constructs, e.g. block comments or ES2015 template strings, highlight.js outputs a single
<span>
that contains newlines. For example:Is converted to:
In https:/hexojs/hexo-util/blob/master/lib/highlight.js#L32, hexo wraps each line with an extra
<span>
, which closes the<span class="string">
early, and causes the rest of that string to be highlighted incorrectly:In addition, it also creates a
.line
span that is in fact multiple lines high.I personally use a custom theme that does not make use of the
.line
class at all, so I simply removed that wrapping span and everything works properly. However it seems many existing themes rely on the.line
class for styling :(The text was updated successfully, but these errors were encountered: