Code block is improperly handled and generates Liquid syntax error

A very simple code block of


generates the following error

Error: Liquid syntax error (line 410): Tag '{%' was not properly terminated with regexp: /\%\}/

I am using the Minima theme with Jekyll with very few adjustments (just enough for MathJax and Mermaid). I’m guessing a tag is likely escaped incorrectly somewhere in a template.

What is at fault here? At present, there’s no way to display code that has such elements in it, such as format strings.

With Jekyll, Markdown files are fist processed by Liquid, and then Markdown, so Liquid syntax is interpreted, even within Markdown code-blocks.

To avoid the problem, the raw tag can be used to disable Liquid processing.

1 Like

Thank you for the fix!

Should it be the case that code blocks are always wrapped with the raw tag by Jekyll?

I think it depends on the language or type of code. Liquid’s delimiters ({{, {%, etc) are fairly rare to find in most code. But for nearly foolproof rendering, you could always wrap with raw.

Thank you for your help!

1 Like