Source code highlighting in Markdown (currently Multimarkdown)

Alan Hogan contact at alanhogan.com
Tue Sep 23 12:24:24 EDT 2014


Jan,

It seems like you might already know of highlight.js:
https://highlightjs.org/ <https://highlightjs.org/>

I understand that this may not seem to address use case #2, but since highlight.js supports node.js, you can probably use it in your build scripts (instead of in the browser).

Note also that some Markdown flavors, such as Github Flavored Markdown and the sort-of fork CommonMark, have syntaxes for explicitly declaring which kind of code you’ve embedded into your document:
https://jgm.github.io/stmd/spec.html#info-string <https://jgm.github.io/stmd/spec.html#info-string>

It looks like this:

```css
* {
  font-family: "jokewood" !important;
}
```

You can compare various flavors’ output of this code, here:
http://ajh.us/babelmark2-fenced-code-with-info-string

> On Sep 23, 2014, at 5:43 AM, Jan Erik Moström <lists at mostrom.pp.se> wrote:
> 
> 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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist6.pair.net/pipermail/markdown-discuss/attachments/20140923/9ea5360b/attachment-0001.html>


More information about the Markdown-Discuss mailing list