Source code highlighting in Markdown (currently Multimarkdown)

Waylan Limberg waylan.limberg at icloud.com
Tue Sep 23 18:17:51 EDT 2014


Jan,

Python-Markdown offers a [codehilite] extension which may meet your needs as
well. Python-Markdown also offers a number of other [extensions] which
provide similar functionality to MMD.

As an aside, our CodeHilite Extension wraps the [Pygments] code highlighting
library. Pygments also offers a command line script. You could possibly pass
you HTML generated by MMD through the Pygments script and get highlighted
code that way. As Pygments is implemented in Python, Python-Markdown can
easily remove that step with no need to call an outside process (as some
tools do).

Waylan

[codehilite]: https://pythonhosted.org/Markdown/extensions/code_hilite.html
[extensions]: https://pythonhosted.org/Markdown/extensions/index.html
[Pygments]: http://pygments.org/

-----Original Message-----
From: Markdown-Discuss [mailto:markdown-discuss-bounces at six.pairlist.net] On
Behalf Of Jan Erik Moström
Sent: Tuesday, September 23, 2014 8:43 AM
To: Discussion related to Markdown.
Subject: Source code highlighting in Markdown (currently Multimarkdown)

I'm using a script to convert a set of markdown files to static web sites -
sites for various courses I'm teaching. This script uses multimarkdown to do
the actual conversion.

Since I mostly teach various programming courses I would like to have syntax
highlighting of the source code I present.

What is the best way to do this?

I'm producing sites that is either:

+ Static webpages where I can decide everything (almost) HTML that is 
+ included in a CMS where I have very very very very
little control of how things should be displayed. I can basically enter HTML
code in a field and hope that it turns out OK

What recommendations do have for doing this?

I can for example see that multimarkdown uses fenced code blocks that
assumes that I have the ability to use a javascript library to do the actual
syntax hightlighting. Which would work in the first case but probably not in
the second.
_______________________________________________
Markdown-Discuss mailing list
Markdown-Discuss at six.pairlist.net
https://pairlist6.pair.net/mailman/listinfo/markdown-discuss



More information about the Markdown-Discuss mailing list