Code Highlighting#

Code blocks can be highlighted for increased readability.
Please note that there are multiple ways of highlighting code in a MkDocs site and some methods may conflict with each other.

PyMdown and Pygments#

PyMdown Extensions and the Pygments library can be used to enable language-specific code hilighting in code blocks and in inline code. They work by adding highlighting to code as it is rendered to HTML during the MkDocs build process.

Configuration Instructions:

highlight.js#

The highlight.js library can be used to enable language-specific code highlighting. This library works by applying code highlighting to a page after it is loaded in the user's web browser.

Configuration Instructions:


  1. light blue background with red strings and green commands. ↩

  2. dark grey background with light blue strings and white commands. ↩

  3. white background with green strings and brown commands. ↩

  4. black background with bright green strings and orange commands. ↩