Skip to content

Commit b42703e

Browse files
committed
fix(markdown) Ignore mid_word underscores
1 parent 5697ae5 commit b42703e

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

src/languages/markdown.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,8 @@ export default function(hljs) {
156156
end: /\*/
157157
},
158158
{
159-
begin: /_(?![_\s])/,
160-
end: /_/,
159+
begin: /(?<![a-zA-Z0-9])_(?![_\s])/,
160+
end: /_(?![a-zA-Z0-9])/,
161161
relevance: 0
162162
}
163163
]

test/markup/markdown/bold_italics.expect.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,6 @@ _ not italic_
3131
<span class="hljs-quote">&gt; * One (this point is italic)</span>
3232
<span class="hljs-quote">&gt; * Two</span>
3333
<span class="hljs-quote">&gt; * Three</span>
34+
35+
No italics mid_word underscores.
36+
But italics for <span class="hljs-emphasis">_full_word_</span> with underscores.

test/markup/markdown/bold_italics.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,6 @@ _ not italic_
3131
> * One (this point is italic)
3232
> * Two
3333
> * Three
34+
35+
No italics mid_word underscores.
36+
But italics for _full_word_ with underscores.

0 commit comments

Comments
 (0)