Closed guoqqqi closed 1 year ago
Remark-directive only works with Docusaurus v3 and is installed by default: that's how we support admonitions now.
Are you using Docusaurus v3? Because this won't work in Docusaurus v2.
If yes please create a repro, I can't help without seeing your code.
Closing because a repro was provided but uses Docusaurus v2, which won't support remark directives.
Please upgrade to Docusaurus v3 (alpha). It's safe, I'm writing marketing material and upgrade guides for the official launch.
You can see in the mdx playground that it works by turning the "remark-directive" option on:
Have you read the Contributing Guidelines on issues?
Prerequisites
npm run clear
oryarn clear
command.rm -rf node_modules yarn.lock package-lock.json
and re-installing packages.Description
I use the
remark-directive
plugin and want to customize a directive to specify the rendering of part of the markdown file. I cannot obtain the information about the directive in my custom plugin. It is always rendered as<p />
Reproducible demo
https://github.com/guoqqqi/docusaurus-remark-plugin
Steps to reproduce
@docusaurus/plugin-content-docs
pluginremark-directive
plugin and add it to thedocusaurus.config.js
fileexport const pluginFiled = () => { const transformer = async (ast) => { visit(ast, (node) => { if (node.type === 'textDirective' || node.type === 'leafDirective' || node.type === 'containerDirective') { console.log('node: ', node); const isPluginField = node.name === 'plugin-field'; if (!isPluginField) return; } }); }
return transformer; };
:::plugin-field 123 :::