0

I searched the internet and couldn't find a list of languages that are supported by python markdown's codehilite extension via the command line?

And is there an easy way to "extend" the codehilite extension to support other languages like "julia"?

E.g., how I currently use it would be having the language specified in an markdown document

:::python
print('hello world')

And then convert it via

python -m markdown -x codehilite my.md > my.html

and then inserting the codehilite.css header

  • 1
    Maybe I'm missing something, but isn't the language supported by codehilite... erm, Python? Various implementations of Markdown support various languages; [example](http://support.codebasehq.com/articles/tips-tricks/syntax-highlighting-in-markdown). – Robert Harvey Jun 03 '14 at 16:41
  • I see... that was my question, does codehilite support any other language then Python at all? –  Jun 03 '14 at 19:55
  • I suspect that it can, but I also suspect that, if you're using some other language, then you're also using a different flavor of Markdown (codehilite being specifically designed for Python). – Robert Harvey Jun 03 '14 at 19:59

1 Answers1

4

Python-Makown's CodeHilite extension uses the Pygments library to highlight code blocks, so any language supported by Pygments is supported.

Those languages are implemented by Pygments through a variety of lexers. Each lexer defines a list of short names. Any of those names will trigger that particular lexer. For example, the JavascriptLexer defines the short names js and javasript, so either of those will trigger highlighting the code as JavaScript:

Some markdown text.

:::JavaScript
// some JavaScript code

Of course, the list could change as Pygments changes, so is doesn't make sense for Python-Markdown to reproduce the list. The CodeHilite extension documentation links to Pygments with the expectation you will follow the link and find the list yourself. Perhaps that documentation could be a little more clear?

Waylan
  • 37,164
  • 12
  • 83
  • 109
  • Thanks, this is very helpful. I see that "Julia" is not in this list of supported languages, yet. This explains why it didn't work. But this answered my question. Thank you! –  Jun 03 '14 at 21:51