eleventy-plugin-unified

2.0.0 • Public • Published

Eleventy Plugin Unified

past latest npm version

Use the unified ecosystem in Eleventy.

You can render, transform and lint:

  • markdown with the remark ecosystem.
  • html with the rehype ecosystem.
  • text with the retext ecosystem.

Install

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, world

It will render like this:

<h1 id="hello-world">Hello, world</h1>

Plugin options

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

Documentation

Configure options for transforms

Adding your own transforms

Using page context and eleventy data

Transforming markdown with remark

Transforming html with rehype

Reporting and linting with retext

Configure options for transforms

// .eleventy.js
eleventyConfig.addPlugin(EleventyUnifiedPlugin, {
  htmlTransforms: [["rehype-format", { indent: "\t" }]],
});

Adding your own transforms

// .eleventy.js
eleventyConfig.addPlugin(EleventyUnifiedPlugin, [
  "./plugins/responsive-tables.js",
]);

or

// .eleventy.js
eleventyConfig.addPlugin(EleventyUnifiedPlugin, {
  transformsDirectory: "./plugins",
  markdownTransforms: ["responsive-tables.js"],
});

With thanks to

Package Sidebar

Install

npm i eleventy-plugin-unified

Weekly Downloads

1

Version

2.0.0

License

MIT

Unpacked Size

12.8 kB

Total Files

7

Last publish

Collaborators

  • nickcolley