Config
Config variables are a concept used to adjust both rendering and behavior of some graphs.
A good example for this are GitGraphs offical documentation 📚.
There are multiple ways to use config variables in Mermaid. Siren stays true to YAML and uses frontmatter syntax:
---
config:
theme: base
gitGraph:
showBranches: false
---
gitGraph
commit
In this example showBranches
is part of the config options supported by GitGraphs.
Usage
In Siren you can use config options in the following way:
- F#
- C#
- Python
- JavaScript
let hotfix = "hotfix"
siren.git([
git.commit()
git.branch(hotfix)
git.checkout(hotfix)
git.commit()
])
// use . syntax or pipe (|>) into siren.withTheme
.withTheme(theme.``base``)
.addGraphConfigVariable(gitGraphConfig.showBranches false)
.write()
string hotfix = "hotfix";
string actual =
siren.git([
git.commit(),
git.branch(hotfix),
git.checkout(hotfix),
git.commit(),
])
.withTheme(theme.@base)
.addGraphConfigVariable(gitGraphConfig.showBranches(false))
.write();
hotfix = "hotfix"
actual = (
siren.git([
git.commit(),
git.branch(hotfix),
git.checkout(hotfix),
git.commit(),
])
.with_theme(theme.base())
.add_graph_config_variable(git_graph_config.show_branches(False))
.write()
)
const hotfix = "hotfix";
const actual =
siren.git([
git.commit(),
git.branch(hotfix),
git.checkout(hotfix),
git.commit(),
])
.withTheme(theme.base)
.addGraphConfigVariable(gitGraphConfig.showBranches(false))
.write();
In case you cannot find a specifc config option you are looking for, you can always use:
graphConfig.custom(configName, configValue)
Here an example in C# using graphConfig.custom
.
string hotfix = "hotfix";
string actual =
siren.git([
git.commit(),
git.branch(hotfix),
git.checkout(hotfix),
git.commit(),
])
.withTheme(theme.@base)
.addGraphConfigVariable(graphConfig.custom("showBranches", "false"))
.write();