markdownit options are created but not used
jaustin opened this issue · comments
eleventy-netlify-boilerplate/.eleventy.js
Lines 59 to 65 in f3dabf6
I ended up getting a bit confused by the presence of this block given the removal of the call to
eleventyConfig.setLibrary("md", markdownIt(options));
(removed in 42084ba, perhaps as collateral when removing markdownit-anchor?)
I think it'd be clearer either to make the call to set the options, or remove the block containing the options. In my case this was confusing because at first pass I was expecting breaks to be enabled, but they weren't as the default config was being used, which has breaks: false
(If removing the config, I think the block below can go too)
Thanks for the quick answer, that fix looks sane, though I think the only downside is that for me with this setup the CMS preview will now show different behaviour to the widget itself. Actually I can't really get away from this I don't think?:
- With breaks in markdown-it: Rendered output matches Slate widget contents itself, but not CMS preview
- Without breaks in markdown-it: Rendered output matches preview in CMS but not in Slate widget
I guess one way to resolve that would be to render the body of the preview with markdown-it directly?
The previews are rendered in React using the Netlify CMS window.CMS
object, probably using (I haven't checked) the react-markdown plugin which requires 2 or more spaces after each line followed by a newline character to generate a <br>
tag, which apparently follows the Markdown spec. I have tested this and it works.
Closing this for now, but let me know if you feel this still needs looking at and I will re-open. Thanks.