Syntax Highlighting of Markdown Fenced Code Blocks

posted 2013-May-22

<dict>
<key>name</key>
<string>markup.raw.block.markdown</string>
<key>begin</key>
<string>^(~{3,})</string>
<key>end</key>
<string>^\1~*\n</string>
</dict>


Why?

Certain superset-Markdown converts (like kramdown) support denoting code blocks not only by indenting the code–a pain when copy-pasting code–but also by “fencing” the code blocks with 3 or more tildes:

Here is some code:

~~~~
def foo()
bar!
end
~~~~


The Markdown language bundle does not support this (since it’s not real Markdown) and so you don’t get proper syntax highlighting. Until you add the above.