Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prism twig makes eleventy build fail #1474

Closed
jan-dh opened this issue Oct 25, 2020 · 3 comments
Closed

Prism twig makes eleventy build fail #1474

jan-dh opened this issue Oct 25, 2020 · 3 comments
Labels
education: template language Learning about a template language.

Comments

@jan-dh
Copy link

jan-dh commented Oct 25, 2020

Describe the bug
I'm using 11ty/eleventy-plugin-syntaxhighlight to highlight code with prism in a .md file.
When trying to highlight twig syntax, eleventy fails to build and I get:

> Having trouble rendering liquid (and markdown) template ./src/posts/test-post.md

`TemplateContentRenderError` was thrown
> Having trouble compiling template ./src/posts/test-post.md

`TemplateContentCompileError` was thrown
> tag set not found, file:./src/posts/test-postmd, line:12

`ParseError` was thrown
> tag set not found

`AssertionError` was thrown:
    AssertionError: tag set not found
     ....

I'm assuming this is because I'm trying to output this:

....
{% set url = lang.getBaseUrl() %}

To Reproduce
Steps to reproduce the behavior:

  1. Install eleventy-plugin-syntaxhighlight
  2. paste this in a markdown file:
{% set test = 'test '% }
  1. See error

Expected behavior
I would expect that everything in prism tags gets ignore and is not interpreted as actual code

Environment:

  • MacOS Catalina 10.15.7
  • Eleventy Version 6.14.4
@binyamin
Copy link
Member

binyamin commented Nov 2, 2020

@jan-dh what templating language are you using (eg. liquid, njk)? Also, can we get a link to the problematic code?

@jan-dh
Copy link
Author

jan-dh commented Nov 2, 2020

Managed to solve this by switching from .ejs to .njk. Issue was with .ejs, don't have the code live anywhere I'm afraid. Did start of from https://github.com/ixartz/Eleventy-Starter-Boilerplate, so that might be a good place to test it on.

@zachleat zachleat added education: template language Learning about a template language. and removed needs-triage needs-review labels Jun 15, 2022
@zachleat
Copy link
Member

For future folks, if the syntax you’re trying to highlight conflicts with the syntax of the parent template, many template languages have a raw output feature. Wrap your syntax highlighted block of code with the raw tag!

Liquid: https://liquidjs.com/tags/raw.html#sidebar
Nunjucks: https://mozilla.github.io/nunjucks/templating.html#raw

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
education: template language Learning about a template language.
Projects
None yet
Development

No branches or pull requests

3 participants