Package Exports
- mdast-util-definition-list
- mdast-util-definition-list/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (mdast-util-definition-list) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
mdast-util-definition-list
mdast extension for definition list
Feature
This package provides mdast utilities to handle definition list with micromark-extension-definition-list.
This includes:
defListFromMarkdown: mdast-util-from-markdown extension (markdown -> mdast)defListToMarkdown: mdast-util-to-markdown extension (mdast -> markdown)defListHastHandlers: mdast-util-to-hast extension (mdast -> hast)
Install
From npm:
$ npm install mdast-util-definition-listUse
import {
defListFromMarkdown,
defListToMarkdown,
defListHastHandlers,
} from 'mdast-util-definition-list';
import { defList } from 'micromark-extension-definition-list';
import { fromMarkdown } from 'mdast-util-from-markdown';
import { toMarkdown } from 'mdast-util-to-markdown';
import { toHast } from 'mdast-util-to-hast';
const md = `
Apple
: Pomaceous fruit of plants of the genus Malus in
the family Rosaceae.
Orange
: The fruit of an evergreen tree of the genus Citrus.
`;
const mdast = fromMarkdown(md, {
extensions: [defList],
mdastExtensions: [defListFromMarkdown],
});
console.log(mdast);
const markdown = toMarkdown(mdast, {
extensions: [defListToMarkdown],
});
console.log(markdown);
const hast = toHast(mdast, {
handlers: defListHastHandlers,
});
console.log(hast);