hast-util-dl-list
v0.1.3
Published
Handlers only for converting mdast definition list nodes into hast elements (<dl>, <dt>, <dd>) for remark-rehype.
Maintainers
Readme
hast-util-dl-list
HAST handlers for rendering mdast definition list nodes
as <dl>, <dt>, and <dd> elements.
This package is designed to be used with remark-rehype.
For the detailed definition list syntax,
→ docs/syntax.md.
Installation
npm install hast-util-dl-listor with pnpm:
pnpm add hast-util-dl-listUsage
import { unified } from 'unified'
import remarkParse from 'remark-parse'
import remarkRehype from 'remark-rehype'
import rehypeStringify from 'rehype-stringify'
import remarkDlList from 'remark-dl-list'
import { dlListHandlers } from 'hast-util-dl-list'
const html = await unified()
.use(remarkParse)
.use(remarkDlList)
.use(remarkRehype, {
handlers: dlListHandlers()
})
.use(rehypeStringify)
.process(`
: term
: description
`)
console.log(String(html))What this package does
- Provides HAST handlers for mdast definition list nodes
- Converts definition lists into
<dl>,<dt>, and<dd> - Preserves
data.hPropertiesanddata.hName
What this package does NOT do
- Does not parse markdown
- Does not serialize markdown
- Does not install remark or rehype plugins automatically
Related packages
This package is part of the unified-dl-list monorepo:
License
MIT
