I use Jekyll to host my blog using Github Pages. The markdown syntax to wrap a block of code is to indent with 4 spaces, this wraps using <pre><code></code></pre>.
So I am not able to apply the appropriate value to a data-language attribute, as the <pre><code></code></pre> isn't actually in my markdown file, it is generated.
Well, I could wrap the code blocks with the HTML manually, but I want to keep my articles written purely in markdown, so the Github preview works.
So I'm wondering how difficult it would be to detect the language of the code inside the <pre><code></code></pre> block, and then apply the appropriate styling to it. It doesn't have to be 100% accurate, just better than what I am doing at the moment:
$("pre > code").attr('data-language', 'generic');
Resulting HTML generated by Jekyll: