How to use rehype-external-links
with micromark
#132
Answered
by
ChristianMurphy
jespertheend
asked this question in
Q&A
-
The readme from Should I add it to |
Beta Was this translation helpful? Give feedback.
Answered by
ChristianMurphy
Apr 11, 2023
Replies: 1 comment 2 replies
-
Usage would go through remark (which wraps micromark) and rehype. import {unified} from 'unified'
import remarkParse from 'remark-parse'
import remarkRehype from 'remark-rehype'
import rehypeExternalLinks from 'rehype-external-links'
import rehypeStringify from 'rehype-stringify'
const file = await unified()
.use(remarkParse)
.use(remarkRehype)
.use(rehypeExternalLinks, {rel: ['nofollow']})
.use(rehypeStringify)
.process('[rehype](https://github.com/rehypejs/rehype)')
console.log(String(file)) |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
jespertheend
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage would go through remark (which wraps micromark) and rehype.
For example https://github.com/rehypejs/rehype-external-links#use