Skip to content

Adding Syntax Highlighting for a New Language

Peter Ernst edited this page May 21, 2020 · 1 revision

To add support for a language which is not already supported out-of-the box you would:

  1. navigate to Getting highlight.js
  2. scroll down to Custom Package section and select one or more of the languages you want. E.g. PHP and PHP Template
  3. click on download. This will download a ZIP file with the required resources including all highlighting themes.
  4. if you want to use the new styles on a conversion project created by New-StaticHTMLSiteProject, copy highlight.pack.js from the ZIP file over to the Template/js directory of your project. If you are not using conversion projects, create a new custom template with New-HTMLTemplate and copy highlight.pack.js from the ZIP file over to the js directory of the custom template.
  5. mission accomplished. Enjoy the new highlighting styles.

Now, if you want to use any of the highlighting themes that came with the download package, do this:

  1. Copy the theme from the ZIP file's styles directory to the styles directory of the template you are going to use.
  2. Edit md-template.html in the template directory and load the theme in the head section like so:
<link rel="stylesheet" type="text/css" href="styles/my-favorite-theme.css" />

Clone this wiki locally