surjithctly / neat-starter

Starter Template for Netlify CMS, Eleventy, Alpine JS & Tailwind CSS
https://neat-starter.netlify.app/
MIT License
333 stars 105 forks source link

Markdown in frontmatter doesn't get HTML tags in output #7

Closed wohfab closed 3 years ago

wohfab commented 3 years ago

Hey there,

I am using your starter and it is really amazing! One issue I ran into is, that when I have a markdown field in my data frontmatter, it just gets output as one line of text with no HTML tags, thus not preserving paragraphs etc.

Maybe you have an idea, how to fix that?

surjithctly commented 3 years ago

Hello,

It should work fine if the yaml & markdown plugin formatting it correctly. may be do a console.log on it to see if it returns expected output.

or, send me some code example where I can replicate the issue.

~Surjith

wohfab commented 3 years ago

Thanks for the quick reply! I got it working with the filter in this issue comment.

Adding this to .eleventy.js:

  eleventyConfig.addFilter("md", function (content = "") {
    return markdownIt({ html: true }).render(content);
  });