Guides
Write text with variables
docgen:text writes text from a template that holds variables. With no code=, the text goes in the sentence:
docs/machines/guide-text-inline.md
Before
Install it with <!-- docgen:text text="go install example.com/lamp@{version}" --><!-- /docgen:text -->.
After
Install it with <!-- docgen:text text="go install example.com/lamp@{version}" -->go install example.com/lamp@v1.2.3<!-- /docgen:text -->.
Preview
Install it with go install example.com/lamp@v1.2.3.
Markers do not work inside a code block, so add code= to write a code block:
.docgen.yaml
vars:
version: v1.2.3docs/machines/guide-text.md
Before
<!-- docgen:text text="go install example.com/lamp@{version}\n# {{version} holds the version." code=sh -->
<!-- /docgen:text -->
After
<!-- docgen:text text="go install example.com/lamp@{version}\n# {{version} holds the version." code=sh -->
```sh
go install example.com/lamp@v1.2.3
# {version} holds the version.
```
<!-- /docgen:text -->
Preview
go install example.com/lamp@v1.2.3
# {version} holds the version.{key} is a variable, {{ is a literal {, and \n is a line ending, and \\ is a backslash. code= sets the language of the block, and code="text" is a plain block.
For details, see docgen:text.
Source: docs/guides/text.md