Markdown friendly synatx highlighting

Ivan Sagalaev Maniac at SoftwareManiacs.Org
Sat Jan 20 10:55:47 EST 2007

Hello everyone!

I am using markdown on my blog (Markdown Extra actually, thank you
Michel!). I use code snippets heavily and I really appreciate that I
shouldn't escape '<' and '>' manually. However I always wanted to use
syntax highlighting for code snippets and it's a bit hard with markdown
because most highlighters require some indication of a code language
and/or of a code block itself. And there is no means in markdown to
supply it (to me knowledge at least).

So I wrote my own syntax highlighter that works entirely in Javascript
and, most importantly, doesn't require any custom HTML classes for code
blocks. Basically it looks for all <pre><code>...</code></pre> detects a
language and highlights it automagically. Which also means that you
won't have to do anything to your markdown content if you decide to use
the highlighter. Language autodetection is done heuristically and while
works pretty well will certainly fail from time to time. For such cases
there are means to specify language explicitly thought you should fall
back to HTML for this.

If this sounds interesting please get it and let me know what you think:

Thank you!

More information about the Markdown-Discuss mailing list