Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow custom markdown engines to access preprocessing engine #2777

Open
danburzo opened this issue Jan 27, 2023 · 1 comment
Open

Allow custom markdown engines to access preprocessing engine #2777

danburzo opened this issue Jan 27, 2023 · 1 comment
Labels

Comments

@danburzo
Copy link
Contributor

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

@danburzo
Copy link
Contributor Author

danburzo commented Jan 28, 2023

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() 🫠

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants