-
Hi, I'm building a documentation site using eleventy and am leaning heavily on this remark plugin to process Markdown docs and turn code blocks into interactive examples (iframes for CSS insulation and responsive resizing). It's mostly working, but one of the pain points I have right now is that all of the templates for the site live in Nunjucks except this one, which uses the hastscript I've figured out how to stringify the code node and pass it as raw content to the template as data, then replace the Anyway, I think that some of this comes down to me not understanding how to get from mdast nodes with |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Another thing that might be really cool is a hastscript-like tagged template that would allow me to interleave this into my processing pipeline: hype`
<section>
<h2>${node.meta}</h2>
<iframe srcdoc=${node.value}></iframe>
${node}
</section>
` ...which I guess is possible with |
Beta Was this translation helpful? Give feedback.
-
It looks like you want to apply the Nunchucks template, then do highlighting? |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
async visitor
— those don‘t work, that might be a problem? Your plugin itself is sync (because it doesn‘t return a promise or accept a callback), but the visitor runs async. So this probably introduces a race condition?remark-highlight.js
withrehype-highlight
, as @ChristianMurphy also mentioned. Highlighting lives more in HTML/hast/rehype space than markdownmdast-util-to-string
I lose all of the highlighting [...]” This is not somethingmdast-util-to-string
is for. Whatmdast-util-to-string
does is try to get the text in something (sort of likedomNode.innerText
ordomNode.textContent
). There are different pr…