Sand Fox (Posts about commonmarker)https://sandfox.me/tags/commonmarker.xml2024-03-25T17:50:28ZAnton SmirnovNikolaEmbracing CommonMark as the One True Markdownhttps://sandfox.me/ruby/embracing-commonmark.html2016-04-06T02:46:00+03:002016-04-06T02:46:00+03:00Anton Smirnov<div><p>As you may know, <a class="reference external" href="https://commonmark.org/">CommonMark</a> is a project aiming to create unified and
unambiguous Markdown syntax specification. So, I'm in. I want to spread
the word and even use it in my own blog.</p>
<p>The trouble number one is that Jekyll uses <a class="reference external" href="https://rubygems.org/gems/kramdown">kramdown</a> by default.
So we find a gem and the gem is <a class="reference external" href="https://rubygems.org/gems/jekyll-commonmark">jekyll-commonmark</a>. Oh hell, we lost
syntax highlighting :(</p>
<p>The trouble number two is that CommonMark standard lacks support for
server side syntax highlighting. That's bad, I don't want any JavaScript
on my static pages. Let's try to wrap it somehow and enable
syntax highligting.</p>
<p>The strong side of Ruby CommonMark implementation, <a class="reference external" href="https://rubygems.org/gems/commonmarker">CommonMarker</a> is
its ability to parse a document to the abstract syntax tree, so let's use
it to extract our blocks and highlight them with <a class="reference external" href="https://rubygems.org/gems/rouge">Rouge</a> for example.</p>
<p><a href="https://sandfox.me/ruby/embracing-commonmark.html">Read moreā¦</a> (1 min remaining to read)</p></div>