Skip to content

Commit

Permalink
Improve bold, italic and strikethrough parsing (GFM)
Browse files Browse the repository at this point in the history
Now they are more similar to GitHub's algorithm.
  • Loading branch information
maliayas committed Oct 28, 2013
1 parent 608f8d3 commit 960e3ca
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Markdown.tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@
<dict>
<key>begin</key>
<string>(?x)
\b(\*\*|__)(?=\S) # Open
(?&lt;!\w)(\*\*|__)(?=\S) # Open
(?=
(
&lt;[^&gt;]*+&gt; # HTML tags
Expand Down Expand Up @@ -456,7 +456,7 @@
| (?!(?&lt;=\S)\1). # Everything besides
# style closer
)++
(?&lt;=\S)\1\b # Close
(?&lt;=\S)\1 # Close
)
</string>
<key>captures</key>
Expand Down Expand Up @@ -546,7 +546,7 @@
<dict>
<key>begin</key>
<string>(?x)
(~~)(?=[^\s~]) # Open
(?&lt;!\w)(~~)(?=[^\s~]) # Open
(?=
(
&lt;[^&gt;]*+&gt; # HTML tags
Expand Down Expand Up @@ -926,7 +926,7 @@
<dict>
<key>begin</key>
<string>(?x)
\b(\*|_)(?=\S) # Open
(?&lt;!\w)(\*|_)(?=\S) # Open
(?=
(
&lt;[^&gt;]*+&gt; # HTML tags
Expand Down Expand Up @@ -964,7 +964,7 @@
| (?!(?&lt;=\S)\1). # Everything besides
# style closer
)++
(?&lt;=\S)\1\b # Close
(?&lt;=\S)\1 # Close
)
</string>
<key>captures</key>
Expand Down
5 changes: 5 additions & 0 deletions tests/GFM.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ The word `complicated` must be neither bold nor italic below:
perform_complicated_task
perform__complicated__task

But the first part below is italic and bold respectively:

_perform_complicated_task
__perform__complicated__task

# Fenced Code Blocks

## In / Near List Items
Expand Down

0 comments on commit 960e3ca

Please sign in to comment.