Markdown 或其他简单标记语言中的条件逻辑?

reh*_*ift 5 documentation markdown documentation-generation

我正在寻找一种类似 Markdown 的语言的实现,它允许我在文档中嵌入“条件逻辑”。

我想该文档会类似于:

This text should be included in all processed versions of the document

[platform==foo]
This is an example for platform Foo

[platform==bar]
This is an example for platform Bar
Run Code Online (Sandbox Code Playgroud)

然后可以通过将参数传递给处理脚本来生成文档的不同版本:

./process-markdown --platform=foo
Run Code Online (Sandbox Code Playgroud)

我的谷歌搜索没有返回任何接近于此的内容,尽管我觉得软件文档中必须存在这样的东西。

Son*_*son 1

AsciiDoc有条件包含宏

Doxygen还可以用作标记语言,并具有\if、\endif 等命令。

对于 Markdown,您编写自己的简单正则表达式过滤器脚本可能会更容易。