Markdown Monster Delphi Syntax Highlighting

Overview

  • Download and install a custom version of HighlightJS JavaScript that supports desired languages.
    • Visit the HighlightJS website
    • Specify the desired custom support
    • Download the resulting JavaScript file
    • Install the custom JavaScript file in your Markdown Monster
  • Enable your additional languages by specifying the Fence Name to HighlighterJS Language Name 1
  • Relaunch Markdown Monster for changes to take effect.

Create, Download and Install the Custom HighlightJS Script

  • Visit HighlightJS and click on Download from the main menu at the very top right of the home page.
  • The default HighlightJS script supports all the languages identified as Common.
    • I recommend keeping that minimum set in your custom download.
    • Click the Common check box.

Choosing Common

  • Since Delphi is not included as a Common language, scroll down to the System Category. There, choose Delphi to add it to the list of languages supported.

Choose Delphi

  • Click the green Download button to create and download your custom JavaScript file.
Tip
Generating the custom download takes a few seconds. Resist the temptation to click the Download button multiple times or you will get multiple copies of the same custom download.
  • Open your Markdown Monster. Use Tools→Open Preview Themes Folder from the Main Menu to open the Preview Themes folder. This will open the theme folder currently in use.
  • Use the up arrow (↑) in Explorer to navigate to the Preview Themes Folder.

Tools→Settings

  • Open the scripts folder

Choose Scripts

  • and the highlightjs folder.

Choose HighlightJS

  • Copy the file highlight.min.js from your custom download into Markdown Monster's highlightjs folder.
  • Rename the highlight.js files as follows:
    • Rename highlight.pack.js to highlight.pack_old.js (or a similar name of your choice.)
    • Rename highlight.min.js to highlight.pack.js (this is the name by which the minified version is is known to Markdown Monster.)

Backup Copy and Rename

Enable Delphi Code Fence Names

All forms of Delphi syntax highlighting are handled by a single JavaScript function named Delphi. In order to access that script function you must update Markdown Monster's Json configuration file. Here you must provide the necessary fence name aliases that direct Markdown Monster to the correct highlighting routine.

  • Open Tools→Settings from the main menu.

Choose Tools→Settings

  • From the Settings dialog, choose Edit Json.

Edit Json

  • Scroll down to the Editor Extension Mappings section.

Editor Extension Mappings

  • Continue scrolling to the end of the section and add the required mappings from the Fence Name Designator to the HighlightJS JavaScript name for the language. In this case, we have added several aliases for the Delphi syntax formatter.

Add Desired Mappings Fence to HighlightJS

  • Right click to bring up the context menu and Close Document. Since you have changed the document, that will prompt you asking if you want to save your changes. Of course, reply Yes to save them.

Right Click Close

Close and Relaunch Markdown Monster

Relaunching Markdown Monster will use the updated configuration settings to enable Delphi syntax formatting.


  1. Official HighlightJS specifications can be accessed at https://highlightjs.org/