Saying stuff about stuff.

Syntax highlighting Markdown fenced code blocks in Vim

I’ve only just learned that Vim can syntax highlight Markdown fenced code blocks by their language with the addition of a setting in your .vimrc:

let g:markdown_fenced_languages = ['html', 'js=javascript', 'ruby']

The js=javascript syntax above means that a fenced code block with the language js will load the javascript Vim syntax file.

It’s worth noting that this can slow down opening a Markdown file so it sounds like it’s best not to stuff the list with every known language.