Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Core Grammars:
- enh(json) add json5 support [Kerry Shetline][]
- fix(css) `unicode-range` parsing, issue #4253 [Kerry Shetline][]
- fix(csharp) Support digit separators [te-ing][]
- fix(markdown) Ignore mid_word underscores, issue #4279 [Dan Vanderkam]

Documentation:

Expand Down Expand Up @@ -55,6 +56,7 @@ CONTRIBUTORS
[te-ing]: https://github.com/te-ing
[Anthony Martin]: https://github.com/anthony-c-martin
[NriotHrreion]: https://github.com/NriotHrreion
[Dan Vanderkam]: https://github.com/danvk


## Version 11.11.1
Expand Down
4 changes: 2 additions & 2 deletions src/languages/markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ export default function(hljs) {
end: /\*/
},
{
begin: /_(?![_\s])/,
end: /_/,
begin: /(?<![a-zA-Z0-9])_(?![_\s])/,
end: /_(?![a-zA-Z0-9])/,
relevance: 0
}
]
Expand Down
3 changes: 3 additions & 0 deletions test/markup/markdown/bold_italics.expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,6 @@ _ not italic_
<span class="hljs-quote">&gt; * One (this point is italic)</span>
<span class="hljs-quote">&gt; * Two</span>
<span class="hljs-quote">&gt; * Three</span>

No italics mid_word underscores.
But italics for <span class="hljs-emphasis">_full_word_</span> with underscores.
3 changes: 3 additions & 0 deletions test/markup/markdown/bold_italics.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,6 @@ _ not italic_
> * One (this point is italic)
> * Two
> * Three

No italics mid_word underscores.
But italics for _full_word_ with underscores.