Skip to content

Commit 78f21f0

Browse files
committed
Even smarter regexp handling leading TABs intermixed with tags
1 parent f30dbf6 commit 78f21f0

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/highlight.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ var hljs = new function() {
502502
result = mergeStreams(original, nodeStream(pre), text);
503503
}
504504
if (tabReplace) {
505-
result = result.replace(/^((<[^>]+>)*\t+)/gm, function(match, p1, offset, s) {
505+
result = result.replace(/^((<[^>]+>|\t)+)/gm, function(match, p1, offset, s) {
506506
return p1.replace(/\t/g, tabReplace);
507507
})
508508
}

src/test.html

+2
Original file line numberDiff line numberDiff line change
@@ -1181,6 +1181,8 @@ <h2>Special tests</h2>
11811181
<td>
11821182
<pre><code class="python">for x in [1, 2, 3]:
11831183
<span style="background:yellow"> </span>count(x)
1184+
if x == 3:
1185+
<span style="background:yellow"> </span>count(x + 1)
11841186
</code></pre>
11851187

11861188
<tr>

0 commit comments

Comments
 (0)