nimdoc: Document environment variable substitution (#25623)

Documents environment variable substitution.

Didn't find it mentioned anywhere, even though it's used widely by the
compiler docs.
This commit is contained in:
Zoom
2026-03-23 16:00:55 +04:00
committed by GitHub
parent 446d903fc1
commit c33df006c5

View File

@@ -735,6 +735,24 @@ with a hyperlink to your own code repository.
In the case of Nim's own documentation, the `commit` value is just a commit
hash to append to a formatted URL to https://github.com/nim-lang/Nim.
Substitution via environment variables
--------------------------------------
A simple substitution using environment variables is available.
A reference written as ``|name|`` is replaced during documentation generation if
a matching variable is provided. You can define it via the compiler with
``--putenv``. This is useful for injecting values like version strings or
build-specific text.
```nim
## |foo|
```
```cmd
nim --putenv:foo=bar doc filename.nim
```
The generated html will contain ``bar`` instead of ``foo``.
Other Input Formats
===================