remark-parse
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
@types/mdast | 4.0.4 | 28.74 kB | MIT | prod | |
mdast-util-from-markdown | 2.0.0 | 20.52 kB | MIT | prod | |
micromark-util-types | 2.0.0 | 10.46 kB | MIT | prod | |
unified | 11.0.4 | 30.15 kB | MIT | prod |
Remark-parse is a highly capable JavaScript plugin for the unified system and part of the Remark ecosystem. It enhances unified by facilitating markdown parsing and transforming it into a syntax tree. This allows developers to handle markdown content flexibly and employ syntax extensions to add advanced features.
To install and use remark-parse, follow these steps:
npm install remark-parse
Here's an example :
import rehypeStringify from 'rehype-stringify'
import remarkGfm from 'remark-gfm'
import remarkParse from 'remark-parse'
import remarkRehype from 'remark-rehype'
import {unified} from 'unified'
const doc = `
# Mercury
**Mercury** is the first planet from the [Sun](https://en.wikipedia.org/wiki/Sun)
and the smallest planet in the Solar System.
`
const file = await unified()
.use(remarkParse)
.use(remarkGfm)
.use(remarkRehype)
.use(rehypeStringify)
.process(doc)
console.log(String(file))
Running this script will transform your markdown into HTML.
The official documentation of remark-parse can be found on GitHub at https://github.com/remarkjs/remark/tree/main/packages/remark-parse
. The repository's README file provides a detailed explanation about the plugin and its usage. Its vast ecosystem, along with the plethora of examples provided, make it an instrumental tool in markdown handling.