lumeland / lume

🔥 Static site generator for Deno 🦕
https://lume.land
MIT License
1.88k stars 86 forks source link

Expose Markdown-It disable function #375

Closed bglw closed 1 year ago

bglw commented 1 year ago

Enter your suggestions in details:

👋

I'm looking to run .disable('code') on the default markdown-it instance, but digging through the way its options are exposed I can't see any sanctioned way to do so — only to pass options to the initial constructor, and set the rules.

For now I'm digging deep to run:

site.formats.get(".md").engines[0].engine.disable("code");

But it would be great to have a builtin way to achieve this 🙂

(Also of note: This rule is now actually disabled by default in 11ty.)

oscarotero commented 1 year ago

Hi! Yeah, it makes sense. I just added a new hook to modify directly the markdownIt instance. So in your _config.ts file you can do:

site.hooks.markdownIt((engine) => engine.disable("code"));

It will be available when Lume 1.15.3 is released. Probably it should be disabled by default but I prefer to wait to Lume 2.0.