Download react-spring/docs/scripts/mdx/remark-plugin-parser.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 637 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-spring/docs/scripts/mdx/remark-plugin-parser.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-spring/docs/scripts/mdx/remark-plugin-parser.js
-
curl -L -o remark-plugin-parser.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/1e92f2d0b9e054abc23a53595fd89ad3e2b4a34e/react-spring/docs/scripts/mdx/remark-plugin-parser.js
637 Bytes
| import { visit } from 'unist-util-visit' | |
| /** @type {import('unified').Plugin<[], import('mdast').Root>} */ | |
| export default function parseCallouts() { | |
| return (tree, file) => { | |
| visit(tree, node => { | |
| if ( | |
| node.type === 'textDirective' || | |
| node.type === 'leafDirective' || | |
| node.type === 'containerDirective' | |
| ) { | |
| if ( | |
| node.name !== 'danger' && | |
| node.name !== 'warning' && | |
| node.name !== 'success' && | |
| node.name !== 'note' | |
| ) { | |
| return | |
| } | |
| node.data = node.data ?? {} | |
| node.data.hName = node.name | |
| } | |
| }) | |
| } | |
| } | |