Syntax highlighting for other programming languages within code blocks

BobTodd's Avatar

BobTodd

18 Jan, 2018 07:24 PM

Howdy y'all,

I'm new to MultiMarkdown converter, so I suspect I'm just missing something in the settings (though I've looked... honest!). But is there a way to get syntax highlighting within code blocks?

For example, I was hoping that

    ```HTML
    <span lang='non' class='Unicode'>...</span>
    ```

would produce a code block where <span lang='non' class='Unicode'>...</span> is rendered with syntax-highlighting for HTML. Is there a way to do that?

Thanks for any advice.

Peace out,
Todd

  1. Support Staff 1 Posted by Fletcher on 18 Jan, 2018 07:34 PM

    Fletcher's Avatar

    Todd,

    Thanks for writing in!

    Syntax highlighting requires something to provide the highlighting --
    most people use javascript to do this, using whatever their preferred
    syntax highlighter is.

    Further information is in the MMD 5 User's Guide, including an example
    setup:

    http://fletcher.github.io/MultiMarkdown-5/fences.html

    Hope this helps!

    Fletcher

  2. 2 Posted by BobTodd on 18 Jan, 2018 07:58 PM

    BobTodd's Avatar

    Howdy Fletcher,

    Super. Thanks for the response. And thanks for pointing me to the MMD 5 User's Guide. That helps.

    Your comment also helped me understand the setting "Automatically link to highlight.js...". Clicking this seems to have given some basic syntax highlighting to the HTML export (very sparse, but presumably there's a setting I can muck around with).

    Is there a preference that I can edit which will allow the highlighting to be piped through to the MMD preview, even before export?

    Thanks so much for your help.

    Peace out,
    t

  3. Support Staff 3 Posted by Fletcher on 18 Jan, 2018 08:01 PM

    Fletcher's Avatar

    Everything is already in the preview -- but remember that certain
    javascript routines only run at certain points in a browser page's
    "lifecycle". Many of these routines (e.g. MathJax) run when the page
    loads, but *not* when it is modified. In order to force the entire page
    to reload so that all javascript runs, you can:

    * Manually refresh the preview from menu bar
    * Change preview preferences to always do full reload

    You'll have to decide which approach works best for your particular needs

    F-

  4. 4 Posted by BobTodd on 18 Jan, 2018 08:09 PM

    BobTodd's Avatar

    Howdy Fletcher,

    Super! Got it! Thanks for walking me through it. That's got me up and running.

    Thanks again!

    Peace out,
    t

  5. BobTodd closed this discussion on 26 Jan, 2018 05:56 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac