2

I am using GitHub Pages for my project page.

The project is a simple programming language and I need to write examples code snippets in the documentation. My language needs to use {% and %} literals quite often. In a .md file I wrote the following text:

Syntax: `{%=EXPRESSION%}`

I see that GitHub tried to interpret this text as a Liquid template expression and It could not build the page. Furthermore, I got an email about the page build failure.

The page build failed for the `master` branch with the following error:

The tag `{%=EXPRESSION%}` on line 4 in `Functions.md` was 
not properly closed with `%}`. For more information, see 
https://help.github.com/articles/page-build-failed-tag-not-properly-terminated/.

I do not want my markdown files to be parsed as Liquid templates. I just want these code examples presented as written without being evaluated.

  1. How can I escape the {% literals?
    • I tried writing { but it did not translate to open curly bracket character.
    • I also tried writing {<i>% ... %</i>} everywhere but then the <i> html tags did get escaped and the html code became visible in the output.
  2. Is there a way to disable Liquid in a GitHub project page?

Thank you!

erdos
  • 3,135
  • 2
  • 16
  • 27
  • Possible duplicate of [How to escape liquid template tags?](https://stackoverflow.com/questions/3426182/how-to-escape-liquid-template-tags) – Waylan Oct 02 '18 at 19:23
  • 2
    Another possible duplicate which is probably a better match: [Escaping double curly braces inside a markdown code block in Jekyll](https://stackoverflow.com/q/24102498/866026). – Waylan Oct 02 '18 at 19:32
  • Possible duplicate of [Escaping double curly braces inside a markdown code block in Jekyll](https://stackoverflow.com/questions/24102498/escaping-double-curly-braces-inside-a-markdown-code-block-in-jekyll) – ChrisGPT was on strike Oct 02 '18 at 22:49

1 Answers1

1

you can use {% raw %} {% endraw %} tags

everything between this tags will Escape Liquid Template

example:

{% raw %}

{{8*8}}

{% endraw %}

and if you don't want this {% raw %} tags to appear in your github markdown you can comment them out it still works.

example:

<!--  {% raw %} --> 

{8*8}}

<!-- {% endraw %} -->

Aftab Sama
  • 27
  • 6