-
-
Notifications
You must be signed in to change notification settings - Fork 498
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
Some html content of .njk file that is included in .md file is rendered as raw text #1971
Comments
I believe you're seeing https://www.11ty.dev/docs/languages/markdown/#there-are-extra-and-in-my-output. Here's what my modified .eleventy.js file looked like: const markdownIt = require("markdown-it");
module.exports = (eleventyConfig) => {
const markdownLib = markdownIt({
html: true,
}).disable("code"); // This `.disable("code")` is the important part here.
eleventyConfig.setLibrary("md", markdownLib);
return {
markdownTemplateEngine: "njk",
dir: {
input: "src",
output: "www",
},
};
}; |
More context from the Markdown spec: https://daringfireball.net/projects/markdown/syntax#precode
Although I find that it is rarely behavior I want when using Nunjucks or Liquid templates in Markdown files. |
Thank you very much, I managed to fix the output after editing the indents. Also I have found another solution in several 11ty projects: <ol>
{%- for element in collections.list -%}
<li>
{{element.data.title}}
</li>
{%- endfor -%}
</ol> Replacing |
I finally found it in docs |
I have a list that is represented as separate files:
list/element1.md
list/element2.md
list/list.json
I would like to output them as collection.
I iterate over them in the separate .njk file (this is an example, the real layout is a little bit more complicated):
inlcudes/list.njk
Then I include this .njk file in my final .md page file.
pages/home.md
The problem is that content inside for-loop is wrapped inside pre tag:
I tried different combinations of values in templateEngineOverride parameter but none worked.
Yes, I can use .njk instead .md as page file extension, but I need to be able to use markdown in it. Also I can't output list directly in .md file as I want to put this list in another pages with include.
Please help. Are there any solutions?
The text was updated successfully, but these errors were encountered: