Skip to content

Commit cdf2219

Browse files
authored
Merge pull request #24 from infininight/master
The Italic Conundrum
2 parents c917a83 + 0789e3f commit cdf2219

File tree

2 files changed

+37
-2
lines changed

2 files changed

+37
-2
lines changed

Syntaxes/Markdown (GitHub Italics).tmLanguage

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<key>hideFromUser</key>
88
<true/>
99
<key>injectionSelector</key>
10-
<string>(L:text.html.markdown)</string>
10+
<string>L:(text.html.markdown - (markup.italic.markdown | markup.bold.markdown | markup.raw))</string>
1111
<key>name</key>
1212
<string>Markdown (GitHub Italics)</string>
1313
<key>patterns</key>
@@ -27,7 +27,7 @@
2727
precedence and thus prevent the main Markdown grammar’s pattern for italic text from
2828
matching these underscores.)</string>
2929
<key>match</key>
30-
<string>(_)(?=\w)(?&lt;=\w)</string>
30+
<string>(?&lt;=\w)(_)(?=\w)</string>
3131
<key>name</key>
3232
<string>markup.other</string>
3333
</dict>

Tests/Italics.mdown

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Should Match
2+
3+
_italic_
4+
5+
_italic italic_
6+
7+
_italic_regular
8+
9+
10+
# Should Not Match
11+
12+
regular_regular_regular
13+
14+
15+
# Should Not Match But Does
16+
17+
regular _italic_regular
18+
19+
20+
# Other Cases (Should not match)
21+
22+
__double underscores__
23+
24+
_raw_
25+
26+
raw_raw_raw
27+
28+
Lorem `ipsum_dolor_sit` amet
29+
30+
31+
# Exceptional Cases
32+
33+
$$y_i = \alpha_{j[i]} + \beta x_i + \epsilon_i$$
34+
35+
This is MathJax code which should be parsed separately, but shows just how loose the main spec is about what can be in italic.

0 commit comments

Comments
 (0)