Search code examples
markdownsyntax-highlightingpandoc

How to enable syntax highlighting for Markdown inline code with Pandoc?


The Pandoc manual says:

--no-highlight

Disables syntax highlighting for code blocks and inlines, even when a language attribute is given.

This sounds like there should be syntax highlighting for inline code. But whenever I use Markdown inline code like

This is `print("Hello world")` inline code.

there is no syntax highlighting.


Solution

  • Okay, should have read a little bit further... found the solution. It's called Extension: inline_code_attributes:

    Attributes can be attached to verbatim text, just as with fenced code blocks:

    `<$>`{.haskell}
    

    So the example above becomes:

    This is `print("Hello world")`{.python} inline code.
    

    Makes sense if you think about it... I'll still leave this up in case someone else has this problem.