From c33df006c5297da75bd8f93f811131f6653db1c2 Mon Sep 17 00:00:00 2001 From: Zoom Date: Mon, 23 Mar 2026 16:00:55 +0400 Subject: [PATCH] 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. --- doc/docgen.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/doc/docgen.md b/doc/docgen.md index 34023f1eb8..52d855e6a9 100644 --- a/doc/docgen.md +++ b/doc/docgen.md @@ -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 ===================