Condition

Can use the "if" command for conditional judgment.

define conditional variables

Define conditional variables in the JSON file, which should be of type bool.

main.json
{
    "variable1": "hello",
    "variable2": "world",
    "is_show": true,
    "is_show2": false
}

use conditional judgment

To use conditional judgment in a markdown file, it needs to start with the "if -" or "if n -" directive and start with "<--- {end}--->"End.

Note: The "ifn -" instruction will logically invert the corresponding variable.

main.md
<!--{if-is_show}-->
# variable
<!--{v-variable1}--><!--{ifn-is_show2}--> : <!--{v-variable2}--><!--{end}-->
<!--{end}-->

compiler results

dist/build.md
# variable
hello : world

Last updated