Nunjucks syntax rendering inside markdown codeblock

Hey all, not sure if I’m doing something really basic wrong here, or not searching for the right terms as I can’t find much in the way of similar issues.

I’m using Eleventy on a personal site, and I’m adding some code examples to article pages. For example a Vue snippet

(using 3 backticks and language e.g. ```html)

<li v-for="(todo, index) in todos">
     {{ todo.title }}


    TOKEN: ${{ secrets.GITHUB_TOKEN_NAME }}

In my article preview, this seems to show fine, however, when I publish the article there is nothing where they should be. I’m assuming that as {{ }} is used by nunjucks it’s trying to render these as a property or something?

Not sure if I need to or can escape them in the markdown, or if it’s something I need to tweak in my Eleventy config, not build markdown or something?

Any help would be appreciated :slight_smile: thanks!

Ah, you might want to use raw like this:

{% raw %}
Your code block here 
{% endraw %}

Ahh I see, thank you, is that something I can use inside my main body content editor in a NetlifyCMS page? As that’s how I’m adding my new articles.

1 Like

I think if you use the markdown view, rather than the rich text view it’ll work just as well as it would if you edited markdown files in your editor :+1: