Quick Tip: Using Markdown Filter with SyntaxHighlighter

I was having issues where my syntax highlighting would contain <p> tags and <br> tags that weren’t really there. The reason seemed to be that Markdown was interpreting the code within the Syntax Highlighter code blocks, which is not what I wanted.

To solve…

In your Markdown text format, make sure the order has Syntax Highlighter above Markdown. In your Syntax Highlighter configuration set div as the Tag name setting. Markdown will ignore div tags and Syntax Highlighter will highlight them.

Note that those are the only two filters I use in my Markdown text format. You may need to do more tweaking if you use more filters.

Lastly, I actually prefer highlight.js, so I’ll probably be ditching Syntax Highlighter altogether… my blog is currently using both solutions. Excuse any messes if you see them; it’s in transition.

Leave a Reply

Your email address will not be published.