unifiedjs
- unifiedjs/unified
- interface for parsing, inspecting, transforming, and serializing content through syntax trees
- learn
- 主要处理模块
- retext - natural language
- remarkjs/remark
- rehype/rehype - HTML
- micromark/micromark
- commonmark (optionally gfm) compliant markdown parser
- 如果只需要 markdown -> HTML
- vfile
- Virtual file format for text processing
- mdast-util-to-hast
- AST - 语法树结构
- unist
- Universal Syntax Tree
- 基础 AST - 其他 AST 扩展于该 AST
- Node
- type
- data
- position: Position
- start: Point
- line, column, offset
- end, indent
- start: Point
- Parent extends Node
children: Node[]
- Literal extends Node
- value: any
- mdast
- Markdown Abstract Syntax Tree
- hast
- HTML, SVG, MathML
- Hypertext Abstract Syntax Tree
- nlcst - for natural language
- xast - for XML
- unist
- micromark
- state machine
- 替代 remark-parse
- SyntaxExtension
- HtmlExtension
import { micromark } from 'micromark';
import { gfm, gfmHtml } from 'micromark-extension-gfm';
const value = '* [x] done';
const result = micromark(value, {
extensions: [gfm()],
htmlExtensions: [gfmHtml()],
});
// 输出 HTML
console.log(result);
- MDN
- mdxhast
- recma - Remark (re) and ECMAScript (ecma).
- 用于转换 esast
remark
- remark-parse - markdown -> mdast
- remark-stringify - mdast -> markdown
- remark-gfm - GitHub Flavored Markdown
- remark-toc - Table of Contents
- remark-slug - slugify headings
- remark-html - mdast -> HTML
- 插件列表
- docusaurus 的 md 处理逻辑
rehype
ref
vfile
- vfile
- Virtual file format for text processing