mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-06 07:38:24 +00:00
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:
@@ -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
|
||||
===================
|
||||
|
||||
Reference in New Issue
Block a user