@4dsas/doc_preprocessing 中文文档教程
doc_preprocessing
这个库通过在 markdown 中添加不可见的命令来帮助 markdown 编写者。 有可能使用不可见命令“包含”和“引用”任何降价部分。
在package.json中添加"@4dsas/doc_preprocessing":"^1.0.5"即可在当前项目中添加该包 它添加了特殊的命令来帮助编写 markdown 在预处理过程中,所有命令都将消失。
Reference and Include
命令“Reference”和“Include”可以复制 markdown
Reference
命令是 REF
。 它用作:
<!-- REF nameOfReference-->content<!-- END REF -->
与:
- nameOfReference: is the name of the reference it should be unique
- content: is any content you wish it includes break lines.
示例:
# Title
<!-- REF reference-->Ref1<!-- END REF-->
预处理将删除所有命令
之前:
# Title
<!-- REF reference1 -->Ref1<!-- END REF--> *TEST*
<!-- REF reference2 -->Ref2
<!-- END REF-->
<!-- REF reference3 -->
Ref3
<!-- END REF-->
之后:
# Title
Ref1 *TEST*
Ref2
Ref3
引用通常与包含配对
Include
命令是INCLUDE
。 它用作:
<!-- INCLUDE nameOfReference-->
with:
- nameOfReference: is the name of the reference created by @REF@
Before:
# Title
<!-- REF reference1 -->Ref1<!-- END REF--> *TEST*
<!-- REF reference2 -->Ref2
<!-- END REF-->
<!-- REF reference3 -->
BEFORE <!-- INCLUDE reference1 --> TEST INCLUDE
Ref3
<!-- END REF-->
After:
# Title
Ref1 *TEST*
Ref2
Ref3
BEFORE Ref1 TEST INCLUDE
reference 和 include 没有位置限制,它可以与任何 markdown 文件一起使用。
How it works?
第一遍将找到所有 REFERENCE
并存储它们。 引用与其 ID(文件路径)一起存储。 而且还有开始和结束索引。
如果找到,第二遍将用其引用替换所有 INCLUDE
。 此外,如果不被识别,所有降价评论将被清理。
对于发现的任何错误,都会显示一条日志消息。
该程序将仅在“.mk”文件中搜索,其他文件将保持不变或根据上次修改日期复制到新目的地。
doc_preprocessing
This library helps the markdown writers by adding invisible commands in markdown. Have the possibility to "include" and "ref" any markdown part with invisible commands.
This package can be added in the current project by adding "@4dsas/doc_preprocessing": "^1.0.5" in the package.json It adds special command to help writing markdown All commands will disappear during the preprocess.
Reference and Include
The commands "Reference" and "Include" enables to duplicate markdown
Reference
The command is REF
. It is used as:
<!-- REF nameOfReference-->content<!-- END REF -->
with:
- nameOfReference: is the name of the reference it should be unique
- content: is any content you wish it includes break lines.
Example:
# Title
<!-- REF reference-->Ref1<!-- END REF-->
The preprocess will remove all commands
Before:
# Title
<!-- REF reference1 -->Ref1<!-- END REF--> *TEST*
<!-- REF reference2 -->Ref2
<!-- END REF-->
<!-- REF reference3 -->
Ref3
<!-- END REF-->
After:
# Title
Ref1 *TEST*
Ref2
Ref3
A reference is generally paired with an include
Include
The command is INCLUDE
. It is used as:
<!-- INCLUDE nameOfReference-->
with:
- nameOfReference: is the name of the reference created by @REF@
Before:
# Title
<!-- REF reference1 -->Ref1<!-- END REF--> *TEST*
<!-- REF reference2 -->Ref2
<!-- END REF-->
<!-- REF reference3 -->
BEFORE <!-- INCLUDE reference1 --> TEST INCLUDE
Ref3
<!-- END REF-->
After:
# Title
Ref1 *TEST*
Ref2
Ref3
BEFORE Ref1 TEST INCLUDE
The reference and include does not have a location restriction, it will work with any markdown file.
How it works?
A first pass will find all the REFERENCE
and store them. A reference is stored with it's ID, the file path. But also the start and end index.
A second pass will replace all the INCLUDE
by its reference if found. Moreover all the markdown comments will be cleaned up if they are not recognised.
A log message is displayed for any error found.
The program will only search inside ".mk" files, the other files are untouched or copied to the new destination depending on their last modification date.
你可能也喜欢
- @010webdev/react-prerender 中文文档教程
- @0655-dev/typescript-package-template 中文文档教程
- @0x-klaytn/utils 中文文档教程
- @0x/web3-wrapper 中文文档教程
- @11in/cloudinary 中文文档教程
- @2muchcoffee/nestjs-gql-context 中文文档教程
- @3test/ethereum-proxy-contracts 中文文档教程
- @4c/fetch-mock 中文文档教程
- @4tw/cypress-drag-drop 中文文档教程
- @667/express-jwt-authz 中文文档教程