Stop nunjucks templates with multiple markdown blocks from processing everything? #2963
Replies: 1 comment
-
I'm not sure I understand what you're trying to accomplish. In particular, I don't understand this:
I use nunjucks as my template engine, with a Can you explain why you have |
Beta Was this translation helpful? Give feedback.
-
Frustrated with 11ty and wish I wasn't so here I am:
Have a basic nunjucks template set up with multiple content blocks. Trying to keep the content separate from the layout much as possible.
Content is in markdown md files as per usual. Nunjucks blocks are laid out within, paragraphs of text etc. The way to make this work is using
{% extends 'template.njk' %}
in the .md file.It works for the most part.
But what I'm noticing is the html of the template has all kinds of extra paragraph tags where newlines have been processed etc. And now my main stumbling point is I want some raw plaintext in a textarea in the template and it keeps getting processed as markdown!!! Text sitting in the template which should not be paragraphs etc are being turned into
<p></p>
.Have tried nunjucks
{% raw %}
on it. Have tried all kinds of combinations of markdownTemplateEngine etc...(you need that set to "njk" to make the .md files process the Nunjucks extends, and the blocks first before rendering the content as markdown and sending it back to the template)It's really frustrating to have the template layout being processed as markdown from who knows where.
This seems simple and hopefully someone has a tip. Or have I complicated things too much with the multiple nunjucks blocks idea?
Beta Was this translation helpful? Give feedback.
All reactions