Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
markdown-render
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
markdown-render
Commits
80abbf30
Commit
80abbf30
authored
Apr 11, 2025
by
孙灵跃 leon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
docs readme
parent
a96c0079
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
README.md
README.md
+4
-2
No files found.
README.md
View file @
80abbf30
...
...
@@ -6,10 +6,12 @@
编辑器中解析自定义指令用的是 remark相关的库, remark-parse,remark-rehype,remark-directive,rehype-stringify因为需要对mdast和hast进行更仔细的操作
我们只采用 micromark 相关的库,micromark-extension-directive,micromark-extension-gfm
专注于markdown生成html
其中对 directive 的解析规则是相同的, remark也是借助于micromark完成的,markdown-it 也可以做; 不用markdown-it的原因是里面有大量的 remark-directive 指令相关,markdown-it只会产生token,没有ast的概念,自定义指令不属于 commonMark和gfm的语法, markdown-it词法解析的时候,可能会误判,
<
块状的独占一行,还是可以匹配出来,
行内的可能会和其他文本一起切成一个
token
,然后需要用正则去匹配,自己在重新切分生成
token
,比较麻烦
>
,上面的库则天然支持解析,并且和编辑器配套
最低node版本为21+, package.json中已经指明需要的具体的最低版本
改完代码之后,直接执行 npm run build 命令, 会生成lib目录,里面会生成 umd,cjs,es格式的文件,css文件,type类型文件
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment