You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to modify the markdown engine to squeeze a preprocessing step in between the default liquid preprocessor and the Markdown parser. (Specifically it uses mermaid-cli's Node.JS API to turn mermaid code blocks into inline SVG.) I'm using the pattern suggested by https://www.starfallprojects.co.uk/blog/markdoc-eleventy/#enabling-markdoc , in which I call eleventyConfig.addExtension("md", { compile: fn }), where fn is an async function that receives the content, etc and returns a transformed string.
11ty doesn't seem to be picking up my custom function. I can paste code if it's useful. But here's the gist:
letMermaidPreprocessingMarkdown={compile: asyncfunction(str,inputPath,preTemplateEngine,bypassMarkdown){console.log("trying to preprocess Mermaid");// stuff happensreturnpreprocessedMarkdown;}};eleventyConfig.addExtension("md",MermaidPreprocessingMarkdown);
Can anyone see what's wrong with this? I don't see the logged message I put in as a smoke test.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Using 11ty 3.0.0-alpha.1.
I'm trying to modify the markdown engine to squeeze a preprocessing step in between the default liquid preprocessor and the Markdown parser. (Specifically it uses
mermaid-cli
's Node.JS API to turn mermaid code blocks into inline SVG.) I'm using the pattern suggested by https://www.starfallprojects.co.uk/blog/markdoc-eleventy/#enabling-markdoc , in which I calleleventyConfig.addExtension("md", { compile: fn })
, wherefn
is an async function that receives the content, etc and returns a transformed string.11ty doesn't seem to be picking up my custom function. I can paste code if it's useful. But here's the gist:
Can anyone see what's wrong with this? I don't see the logged message I put in as a smoke test.
Beta Was this translation helpful? Give feedback.
All reactions