Skip to content

Commit

Permalink
Improve Markdown Html Block Colorization (#12696)
Browse files Browse the repository at this point in the history
* Add rule for html comment in blocks

* Match common mark spec for html comments

* Updating tests and fixing some token names

* Fix style and script blocks

* Fix test file results

* Fixed markdown tests for new html logic
  • Loading branch information
mjbvz authored Nov 8, 2016
1 parent e657073 commit 603e08d
Show file tree
Hide file tree
Showing 2 changed files with 114 additions and 137 deletions.
27 changes: 24 additions & 3 deletions extensions/markdown/syntaxes/markdown.tmLanguage
Original file line number Diff line number Diff line change
Expand Up @@ -287,20 +287,41 @@
<array>
<dict>
<key>begin</key>
<string>(?i)(^|\G)\s*(?=&lt;(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del).*&lt;/\2\s*&gt;\s*$)</string>
<string>(^|\G)\s*(&lt;!--)</string>
<key>end</key>
<string>$</string>
<string>(--&gt;)</string>
<key>contentName</key>
<string>block.comment.html</string>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.comment.html</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>punctuation.definition.comment.html</string>
</dict>
</dict>
</dict>
<dict>
<key>begin</key>
<string>(^|\G)\s*(?=&lt;/?(address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h1|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|pre|p|param|script|section|source|style|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(\s|$|/?&gt;))</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>text.html.basic</string>
</dict>
</array>
<key>while</key>
<string>^(?!\s*$)</string>
</dict>
<dict>
<key>begin</key>
<string>(?i)(^|\G)\s*(?=&lt;(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del))</string>
<string>(^|\G)\s*(?=(&lt;[a-zA-Z0-9\-].*&gt;|&lt;/[a-zA-Z0-9\-]&gt;)\s*$)</string>
<key>patterns</key>
<array>
<dict>
Expand Down
Loading

0 comments on commit 603e08d

Please sign in to comment.