I am using prismjs for code block formatting and expected that when I typed out an example bit of liquid code it would be rendered appropriately.
However writing this in my markdown file
```liquid
{{site.tags | inspect}}
```
results in this lot appearing in my blog post:
{"raspberry_pi"=>[#<Jekyll::Document _posts/2014-01-25--remote-control-raspberry-pi.md collection=posts>, #<Jekyll::Document _posts/2013-12-27--controlling-rpi-from-ipad.md collection=posts>], "makers-bootcamp"=>[#<Jekyll::Document _posts/2018-08-16--a-promise-to-compromise.md collection=posts>, #<Jekyll::Document _posts/2018-08-11--a-crisis-of-coding-confidence.md collection=posts>, #<Jekyll::Document _posts/2018-08-01--when-the-teacher-appears.md collection=posts>, #<Jekyll::Document _posts/2018-07-22--starter-leaver.md collection=posts>], "javascript"=>[#<Jekyll::Document _posts/2018-08-16--a-promise-to-compromise.md collection=posts>, #<Jekyll::Document _posts/2018-08-11--a-crisis-of-coding-confidence.md collection=posts>], "ruby"=>[#<Jekyll::Document _posts/2021-05-25--ruby-implicit-explicit-type-conversion.md collection=posts>, #<Jekyll::Document _posts/2019-05-29--in-praise-of-exercism.md collection=posts>], "exercism"=>[#<Jekyll::Document _posts/2019-05-29--in-praise-of-exercism.md collection=posts>], "presentation"=>[#<Jekyll::Document _posts/2019-06-26--iiif-conference.md collection=posts>], "project"=>[#<Jekyll::Document _posts/2019-06-26--iiif-conference.md collection=posts>], "node_modules"=>[#<Jekyll::Document _posts/2019-07-08--npm-dependency.md collection=posts>], "learned-today"=>[#<Jekyll::Document _posts/2020-11-18--jq-json-extraction-wizadry.md collection=posts>, #<Jekyll::Document _posts/2020-11-17--clickable-images-jekyll.md collection=posts>, #<Jekyll::Document _posts/2020-01-25--escaping-virtualenv-hell.md collection=posts>, #<Jekyll::Document _posts/2020-01-02--in-situ-commit-squashing.md collection=posts>, #<Jekyll::Document _posts/2019-11-10--adding-params-view.md collection=posts>, #<Jekyll::Document _posts/2019-09-19--git-rebase-workflow.md collection=posts>, #<Jekyll::Document _posts/2019-07-08--npm-dependency.md collection=posts>], "git"=>[#<Jekyll::Document _posts/2020-12-01--git-patching-with-diff.md collection=posts>, #<Jekyll::Document _posts/2020-01-25--escaping-virtualenv-hell.md collection=posts>, #<Jekyll::Document _posts/2020-01-02--in-situ-commit-squashing.md collection=posts>, #<Jekyll::Document _posts/2019-09-19--git-rebase-workflow.md collection=posts>], "rails"=>[#<Jekyll::Document _posts/2021-01-15--bootstrap-5-rails-6.md collection=posts>, #<Jekyll::Document _posts/2019-11-10--adding-params-view.md collection=posts>], "python"=>[#<Jekyll::Document _posts/2021-01-12--byebug-for-python.md collection=posts>, #<Jekyll::Document _posts/2021-01-05--nested-list-comprehensions.md collection=posts>, #<Jekyll::Document _posts/2020-12-22--conditional-response-class-fastapi.md collection=posts>, #<Jekyll::Document _posts/2020-09-15--python-list-trickery.md collection=posts>, #<Jekyll::Document _posts/2020-01-25--escaping-virtualenv-hell.md collection=posts>], "retirement"=>[#<Jekyll::Document _posts/2020-03-14--retirement-planning-couples.md collection=posts>], "financial-planning"=>[#<Jekyll::Document _posts/2022-01-20--stoic-fear-setting.md collection=posts>, #<Jekyll::Document _posts/2020-03-14--retirement-planning-couples.md collection=posts>], "command-line"=>[#<Jekyll::Document _posts/2021-02-14--bash-logging.md collection=posts>, #<Jekyll::Document _posts/2020-12-15--bash-shortcuts.md collection=posts>, #<Jekyll::Document _posts/2020-11-18--jq-json-extraction-wizadry.md collection=posts>, #<Jekyll::Document _posts/2020-05-21--follow-the-tail.md collection=posts>], "tips"=>[#<Jekyll::Document _posts/2021-01-12--byebug-for-python.md collection=posts>, #<Jekyll::Document _posts/2020-11-18--jq-json-extraction-wizadry.md collection=posts>, #<Jekyll::Document _posts/2020-11-17--clickable-images-jekyll.md collection=posts>, #<Jekyll::Document _posts/2020-09-15--python-list-trickery.md collection=posts>, #<Jekyll::Document _posts/2020-05-27--docker-compose-logs.md collection=posts>], "docker"=>[#<Jekyll::Document _posts/2021-01-12--closed-my-docker-terminal.md collection=posts>, #<Jekyll::Document _posts/2020-05-27--docker-compose-logs.md collection=posts>], "jq"=>[#<Jekyll::Document _posts/2020-11-18--jq-json-extraction-wizadry.md collection=posts>], "jekyll"=>[#<Jekyll::Document _posts/2020-11-30--rogue-newline-jekyll-variables.md collection=posts>, #<Jekyll::Document _posts/2020-11-30--liquid-codeblocks-jekyll-markdown.md collection=posts>, #<Jekyll::Document _posts/2020-11-29--jekyll-posts-by-tag.md collection=posts>], "elasticsearch"=>[#<Jekyll::Document _posts/2021-01-09--elasticsearch-should-or-should-not.md collection=posts>, #<Jekyll::Document _posts/2020-12-14--elasticsearch_dsl-OR-query.md collection=posts>], "fastapi"=>[#<Jekyll::Document _posts/2020-12-22--conditional-response-class-fastapi.md collection=posts>], "makers-bootcamp,"=>[#<Jekyll::Document _posts/2022-01-20--stoic-fear-setting.md collection=posts>], "retirement,"=>[#<Jekyll::Document _posts/2022-01-20--stoic-fear-setting.md collection=posts>], "email"=>[#<Jekyll::Document _posts/2022-02-25--goodbye-hey-dot-com.md collection=posts>]}
Turns out you can escape liquid code expansion by using raw
and endraw
but styled like this:
Incidentally I also learned that you can escape fenced codeblocks in markdown with ~~~
which I used to demonstrate the first code block in this post:
Trying to escape an escape seems to be nightmare that I couldn’t resolve so I’ve had to abandon in favour of screenshots.
Comments