eleventy
eleventy copied to clipboard
Allow custom markdown engines to access preprocessing engine
Is your feature request related to a problem? Please describe.
I'm trying to replace markdown-it with remark, and the docs currently state:
Note that overriding md opts-out of the default pre-processing by another template language of Markdown Files.
Describe the solution you'd like
It would be great if we had access to the Liquid/Nunjucks/etc. pre-processing to make a fully-fledged replacement.
Describe alternatives you've considered
Mimicking the this.mdLib API like florianeckerstorfer/eleventy-plugin-remark is currently doing.
Additional context
No response
For a Nunjucks-specific workaround, you can promisify the event to wait for, and obtain, a reference to the library and associated environment:
const njk = new Promise(resolve => {
config.events.on('eleventy.engine.njk', payload => resolve(payload));
});
Later edit: due to Node's architecture you can't reliably await njk in compile() 🫠
This seems marginally related to the Render plugin, fwiw: https://www.11ty.dev/docs/plugins/render/
Also worth mentioning https://www.11ty.dev/docs/languages/custom/#overriding-a-built-in-template-language (which is not quite what you were asking for)
More recently I would note (for future me or other interested parties) that simple aliases of an existing markdown engine do use the preprocessing engine, as #3339 notes.
Likely this would involve an addition similar to defaultRenderer or might look like #3351.
By default this repo closes enhancement request issues and places them in a queue for folks to upvote. We do this to avoid a large build-up of open issues. We got this idea from the lodash project.
Don’t forget to upvote the first comment with 👍 to register your vote! You can view the current enhancement backlog.