Skip to content

Latest commit

 

History

History
300 lines (268 loc) · 16.7 KB

plugins.md

File metadata and controls

300 lines (268 loc) · 16.7 KB

rehype

Plugins

rehype is a tool that transforms HTML with plugins. See the monorepo readme for info on what the rehype ecosystem is. This page lists existing plugins.

Contents

List of plugins

See awesome-rehype for the most awesome projects in the ecosystem. More plugins can be found on GitHub tagged with the rehype-plugin topic.

💡 Tip: rehype plugins work with HTML and remark plugins work with markdown. See remark’s List of plugins for more plugins.

The list of plugins:

List of utilities

See hast for a list of utilities that work with the syntax tree. See unist for other utilities which work with hast and other syntax trees too. Finally, see vfile for a list of utilities working with virtual files.

Use plugins

To use a plugin programmatically, call the use() function. To use plugin with rehype-cli, pass a --use flag or specify it in a configuration file.

Create plugins

To create a plugin, first read up on the concept of plugins. Then, read the guide on “Creating a plugin with unified”. Finally, take one of existing plugins, which looks similar to what you’re about to make, and work from there. If you get stuck, discussions is a good place to get help.

You should pick a name prefixed by 'rehype-' (such as rehype-format). Do not use the rehype- prefix if the thing you create doesn’t work with rehype().use(): it isn’t a “plugin” and will confuse users. If it works with hast, use 'hast-util-', if it works with any unist tree, use unist-util-, and if it works with virtual files, use vfile-.

Use default exports to expose plugins from your packages, add rehype-plugin keywords in package.json, add a rehype-plugin topic to your repo on GitHub, and create a pull request to add the plugin here on this page!