literalCode
lib.options.literalCode
Docs pulled from | This Revision | 35 minutes ago
For use in the defaultText and example option attributes. Causes the
given string to be rendered verbatim in the documentation as a code
block with the language bassed on the provided input tag.
If you wish to render Nix code, please see literalExpression.
Examples
literalCode usage example
myPythonScript = mkOption {
type = types.str;
description = ''
Example python script used by a module
'';
example = literalCode "python" ''
print("Hello world!")
'';
};
Inputs
languageTag-
The language tag to use when producing the code block (i.e.
js,rs, etc). text-
The text to render as a Nix expression
Noogle detected
Implementation
The following is the current implementation of this function.
literalCode =
languageTag: text:
lib.literalMD ''
```${languageTag}
${text}
```
'';