-
-
Notifications
You must be signed in to change notification settings - Fork 90
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
Configuring markdown-it
#45
Comments
I have thought about this several times, but I didn't decided a proper way to do it. One idea is adding an option to disable default plugins, so you can add it later with your own config options. For example: const site = lume({ disable: ["markdown"] });
site.use(markdown(/** Your config here */)); But I guess most users want to configure these plugins, not disable them. So another idea is being able to pass options to the default plugins in the lume factory: const site = lume({
plugins: {
markdown: {
plugins: [markdownItContainer],
}
}
}); Another idea is providing a container in which all plugins can save their dependencies in order to configure them. For example: const site = lume();
const markdownIt = site.deps.get("markdown-it"); This could be used by other plugins like pug, postcss, etc. But I'm not convinced because it's useful only for the default plugins, not other plugins that the user can configure on register. And other idea is do nothing, due the user always can create an empty Site instance, without plugins. The import Site from "https://deno.land/x/lume/site.js";
import markdown from "https://deno.land/x/lume/plugins/markdown.js";
const site = new Site(options);
site.use(markdown())
return site; For now, the way to access to the markdownIt instance, is getting the property const mdEngine = site.engines.get(".md");
const md = mdEngine.engine;
md.use(markdownItContainer); |
I've added a second argument here to configure the default plugins, so you can pass options to markdown (or any other plugin) by: const site = lume({}, {
markdown: {
options: { html: false },
plugins: [plugin1, plugin2]
}
}) |
That’s very nice. Thanks! |
It should be possible to configure
markdown-it
, for example, to add plugins or to modify renderers.Maybe something like:
The text was updated successfully, but these errors were encountered: