diff --git a/src/languages/markdown.js b/src/languages/markdown.js index 427f6eab22..7d5a15062f 100644 --- a/src/languages/markdown.js +++ b/src/languages/markdown.js @@ -138,11 +138,11 @@ export default function(hljs) { contains: [], // defined later variants: [ { - begin: /_{2}/, + begin: /_{2}(?!\s)/, end: /_{2}/ }, { - begin: /\*{2}/, + begin: /\*{2}(?!\s)/, end: /\*{2}/ } ] @@ -152,11 +152,11 @@ export default function(hljs) { contains: [], // defined later variants: [ { - begin: /\*(?!\*)/, + begin: /\*(?![*\s])/, end: /\*/ }, { - begin: /_(?!_)/, + begin: /_(?![_\s])/, end: /_/, relevance: 0 } diff --git a/test/markup/markdown/bold_italics.expect.txt b/test/markup/markdown/bold_italics.expect.txt index ddc8a59558..a08ae07756 100644 --- a/test/markup/markdown/bold_italics.expect.txt +++ b/test/markup/markdown/bold_italics.expect.txt @@ -19,3 +19,15 @@ ***This is bold and italic*** ___This is bold and italic___ + +** i shouldn't be italic** + +* and I shouldn't be italic either* + +__ not really bold__ + +_ not italic_ + +> * One (this point is italic) +> * Two +> * Three diff --git a/test/markup/markdown/bold_italics.txt b/test/markup/markdown/bold_italics.txt index 5f15ea0d7b..c85202e554 100644 --- a/test/markup/markdown/bold_italics.txt +++ b/test/markup/markdown/bold_italics.txt @@ -19,3 +19,15 @@ __Bold *then italic*__ ***This is bold and italic*** ___This is bold and italic___ + +** i shouldn't be italic** + +* and I shouldn't be italic either* + +__ not really bold__ + +_ not italic_ + +> * One (this point is italic) +> * Two +> * Three