Use the unified ecosystem in Eleventy.
You can render, transform and lint:
npm install eleventy-plugin-unified remark-slug// .eleventy.config.cjs
const EleventyUnifiedPlugin = require("eleventy-plugin-unified");
module.exports = function (eleventyConfig) {
eleventyConfig.addPlugin(EleventyUnifiedPlugin, ["remark-slug"]);
};Then with a markdown file with:
# Hello, worldIt will render like this:
<h1 id="hello-world">Hello, world</h1>| Option | Description | Default |
|---|---|---|
| markdownTransforms | remark plugins | [] |
| htmlTransforms | rehype plugins | [] |
| textTransforms | retext plugins | [] |
| transformsDirectory | directory with your transforms | "." |
| textParser | retext parser | retext-english |
| reporter | vfile reporter | vfile-reporter |
// .eleventy.js
eleventyConfig.addPlugin(EleventyUnifiedPlugin, {
htmlTransforms: [["rehype-format", { indent: "\t" }]],
});// .eleventy.js
eleventyConfig.addPlugin(EleventyUnifiedPlugin, [
"./plugins/responsive-tables.js",
]);or
// .eleventy.js
eleventyConfig.addPlugin(EleventyUnifiedPlugin, {
transformsDirectory: "./plugins",
markdownTransforms: ["responsive-tables.js"],
});