命令行
安装 @accordproject/markdown-cli 获取 npm 软件包 markus 命令行界面(CLI). 安装后,您可以使用 markus 命令及其子命令如下.
要安装 :
npm install -g @accordproject/markdown-cli
使用量
markus 是一个命令行工具,用于调试并使用标记下变换.
markus <cmd> [args]
Commands:
markus transform transform between two formats
Options:
--version Show version number [boolean]
--verbose, -v [default: false]
--help Show help [boolean]
markus transform
这个 markus transform 命令允许您在支持的任意两种格式之间转换.
markus transform
transform between two formats
Options:
--version Show version number [boolean]
--verbose, -v verbose output [boolean] [default: false]
--help Show help [boolean]
--input path to the input [string]
--from source format [string] [default: "markdown"]
--to target format [string] [default: "commonmark"]
--via intermediate formats [array] [default: []]
--roundtrip roundtrip transform [boolean] [default: false]
--output path to the output file [string]
--model array of concerto model files [array]
--template template grammar [string]
--contract contract template [boolean] [default: false]
--currentTime set current time [string] [default: null]
--plugin path to a parser plugin [string]
--extension path to a transform extension [array]
--sourcePos enable source position [boolean] [default: false]
--offline do not resolve external models [boolean] [default: false]
支持的格式 --from 编号 : --to 编号 : --via数字 :
markdown, (中文(简体) ), markdown_cicero, (中文(简体) ), markdown_template, (中文(简体) ), commonmark_tokens, (中文(简体) ), ciceromark_tokens, (中文(简体) ), templatemark_tokens, (中文(简体) ), commonmark, (中文(简体) ), ciceromark, (中文(简体) ), ciceromark_parsed, (中文(简体) ), ciceromark_unquoted, (中文(简体) ), templatemark, (中文(简体) ), ciceroedit, (中文(简体) ), html, (中文(简体) ), plaintext。 。 。 .
示例
运行 transform 标记下的文件 :
markus transform --input README.md
返回 :
{
"$class": "[email protected]",
"xmlns": "http://commonmark.org/xml/1.0",
"nodes": [
{
"$class": "[email protected]",
"level": "1",
"nodes": [
{
"$class": "[email protected]",
"text": "Hello World"
}
]
},
{
"$class": "[email protected]",
"nodes": [
{
"$class": "[email protected]",
"text": "This is the Hello World of Accord Project Templates. Executing the clause will simply echo back the text that occurs after the string "
},
{
"$class": "[email protected]",
"text": "Hello"
},
{
"$class": "[email protected]",
"text": " prepended to text that is passed in the request."
}
]
}
]
}
--from 财务报告和审定财务报表 --to 选项
设置源和目标格式 。 以下将下标记转换为 HTML :
markus transform --from markdown --to html --input README.md
返回 :
<html>
<body>
<div class="document">
<h1>Hello World</h1>
<p>This is the Hello World of Accord Project Templates. Executing the clause will simply echo back the text that occurs after the string <code>Hello</code> prepended to text that is passed in the request.</p>
</div>
</body>
</html>
--via 选项
当两种格式之间有好几种路径时,您可以通过中间格式进行路由. 以下转型从 markdown 改为 html 通过 ciceromark数字 :
markus transform --from markdown --via ciceromark --to html --input README.md
--roundtrip 选项
您可以在两种格式之间绕行——从源到目标再转换回源. 譬如说, markdown → ciceromark → markdown数字 :
markus transform --from markdown --to ciceromark --input README.md --roundtrip
返回 :
Hello World
====
This is the Hello World of Accord Project Templates. Executing the clause will simply echo back the text that occurs after the string `Hello` prepended to text that is passed in the request.
圆通可能会在源码下标值上造成小的文字差异,但应当始终是等同的. 在以上示例中,ATX标题 # Hello World 已转换为相应的 Setext 标题.
--model 财务报告和审定财务报表 --contract 选项
处理时 模板马克,提供音乐会模式 --model 添加 --contract 如果模板是合同(否则则被视为一项条款).
例如,以下将模板马克文件转换到其DOM:
markus transform \
--from markdown_template --to templatemark \
--model model/model.cto \
--input text/grammar.tem.md
返回 :
{
"$class": "[email protected]",
"xmlns": "http://commonmark.org/xml/1.0",
"nodes": [
{
"$class": "[email protected]",
"name": "top",
"elementType": "org.accordproject.helloworld.HelloWorldClause",
"nodes": [
{
"$class": "[email protected]",
"nodes": [
{
"$class": "[email protected]",
"text": "Name of the person to greet: "
},
{
"$class": "[email protected]",
"name": "name",
"elementType": "String"
},
{
"$class": "[email protected]",
"text": "."
},
{
"$class": "[email protected]"
},
{
"$class": "[email protected]",
"text": "Thank you!"
}
]
}
]
}
]
}
--extension 选项
过 --extension path/to/ext.js (可重复)在运行时注册自定义变换扩展. 扩展为导出模块 { format?, transforms? } 地点 format 宣布新的格式 transforms 在变换图中宣布边缘为/从它开始。 例子参见此包中的集成测试.
许可证
Accord Project源代码文件在位于LICENSE文件的Apache许可证2.0版本(Apache-2.0)下提供. 项目文件文件根据创用CC-BY-4.0国际许可证提供 http://creativecommons.org/licenses/by/ 4.0/ 页面存档备份,存于互联网档案馆。 。 。 .