Guides
Use variables
Keep a value such as your release version in .docgen.yaml, and use it in each page:
vars:
version: v1.2.0docgen:var puts the value in a sentence:
.docgen.yaml
vars:
version: v1.2.3docs/machines/guide-var.md
Before
The current version is <!-- docgen:var name=version --><!-- /docgen:var -->.
After
The current version is <!-- docgen:var name=version -->`v1.2.3`<!-- /docgen:var -->.
Preview
The current version is v1.2.3.
docgen:text puts it in other text, or in a code block with code=:
.docgen.yaml
vars:
version: v1.2.3docs/machines/guide-version.md
Before
Version <!-- docgen:var name=version --><!-- /docgen:var --> is out. Install it:
<!-- docgen:text text="go install example.com/lamp@{version}" code=sh -->
<!-- /docgen:text -->
After
Version <!-- docgen:var name=version -->`v1.2.3`<!-- /docgen:var --> is out. Install it:
<!-- docgen:text text="go install example.com/lamp@{version}" code=sh -->
```sh
go install example.com/lamp@v1.2.3
```
<!-- /docgen:text -->
Preview
Version v1.2.3 is out. Install it:
go install example.com/lamp@v1.2.3A release is one line in .docgen.yaml, then docgen update, then the tag. A variable that no marker uses fails check.
With print=%q, the value is in quotes, as "v1.2.3". With code=false, it has no backticks.
For details, see docgen:var.
Source: docs/guides/variables.md