[[_TOC_]] By default, Lektor doesn't provide syntax highlighting for markdown codeblocks like Github or Gitlab do: Without syntax highlighting: ``` print('Hello world!') ``` With syntax highlighting: ```py print('Hello world!') ``` To enable syntax highlighting, Lego provides the [lektor-markdown-highlighter][] plugin [lektor-markdown-highlighter]: ## Enabling the syntax highlighting plugin Add the plugin to your project: ```bash ln -sT ../lego/packages/envvars/ packages/lektor-markdown lektor plugins reinstall ``` ## Using the plugin 1. Create an empty `configs/markdown-highlighter.ini` file 2. Add `` to any template where you want syntax highlighting. This is usually the `templates/meta.html` or `templates/layout.html` file 3. Add a language name to your codeblocks, like below: ```py print('Hello world!') ``` A list of valid languages can be found at ## Changing the pygments theme Pygments supports different styles. To use a theme other than the default "tango", add the following to `configs/markdown-highlighter.ini`: ```ini [pygments] style = zenburn ``` Pygments provides a [list of built-in styles][]. [list of built-in styles]: ## Bugs Using a language not on the [pygments language list][] will cause a build failure. The plugin should be patched to allow for invalid names, and the patch should be upstreamed. [pygments language list]: