-
-
Notifications
You must be signed in to change notification settings - Fork 61
Closed
Labels
Description
Say we have a code block in a language that supports multiline comments or strings, such as Coffeescript:
myFunc """
This is a
string that
spans multiple
lines.
"""Hexo will render the following html:
<figure class="highlight coffeescript">
<table>
<tbody>
<tr>
<td class="code">
<pre>
<span class="line">myFunc <span class="string">"""</span><br>
<span class="line"> This is a</span><br>
<span class="line"> string that</span><br>
<span class="line"> spans multiple</span><br>
<span class="line"> lines.</span><br>
<span class="line">"""</span></span><br>
</pre>
</td>
</tr>
</tbody>
</table>
</figure>This seems to prevent hljs from properly inserting <span> elements. I'll admit I don't understand what this line, which adds the .line spans, is supposed to accomplish (ie, why do we want each line wrapped in its own span in the first place), but it's doing it in a naive way that doesn't account for existing span elements that span more than one line. What it should produce is:
<figure class="highlight coffeescript">
<table>
<tbody>
<tr>
<td class="code">
<pre>
<span class="line">myFunc <span class="string">"""</span></span><br>
<span class="line string"> This is a</span><br>
<span class="line string"> string that</span><br>
<span class="line string"> spans multiple</span><br>
<span class="line string"> lines.</span><br>
<span class="line string">"""</span><br>
</pre>
</td>
</tr>
</tbody>
</table>
</figure>...which would be correctly highlighted.
Reactions are currently unavailable