Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(markdown) strong/emphasis requires whitespace after #3520

Merged
Merged
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
8 changes: 4 additions & 4 deletions src/languages/markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}/
}
]
Expand All @@ -152,11 +152,11 @@ export default function(hljs) {
contains: [], // defined later
variants: [
{
begin: /\*(?!\*)/,
begin: /\*(?![*\s])/,
end: /\*/
},
{
begin: /_(?!_)/,
begin: /_(?![_\s])/,
end: /_/,
relevance: 0
}
Expand Down
12 changes: 12 additions & 0 deletions test/markup/markdown/bold_italics.expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,15 @@

<span class="hljs-strong">**<span class="hljs-emphasis">*This is bold and italic*</span>**</span>
<span class="hljs-strong">__<span class="hljs-emphasis">_This is bold and italic_</span>__</span>

** i shouldn&#x27;t be italic**

<span class="hljs-bullet">*</span> and I shouldn&#x27;t be italic either*

__ not really bold__

_ 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>
12 changes: 12 additions & 0 deletions test/markup/markdown/bold_italics.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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