mirror of
https://gitlab.com/TECHNOFAB/nixlets.git
synced 2026-02-02 03:05:09 +01:00
docs: add docs for generating docs for nixlet values, update nixmkdocs
This commit is contained in:
parent
471cb8b7b5
commit
f574e32083
3 changed files with 42 additions and 3 deletions
38
docs/generating_docs.md
Normal file
38
docs/generating_docs.md
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
# Generating Docs
|
||||||
|
|
||||||
|
Like you can see on the left (if you are looking at the built MkDocs site), it's possible
|
||||||
|
to generate docs for Nixlets' values automatically.
|
||||||
|
Since the values are basically just Nix module options, we can generate docs similarly to NixOS options etc.
|
||||||
|
|
||||||
|
## Generate Markdown
|
||||||
|
|
||||||
|
This is all that's needed:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
(<nixlet>).mkDocs {
|
||||||
|
# Params:
|
||||||
|
# transformOptions ? opt: opt,
|
||||||
|
# filter ? _: true,
|
||||||
|
# headingDepth ? 3,
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
This will return the path to a markdown file containing the docs, like this:
|
||||||
|
|
||||||
|
````md
|
||||||
|
### `example`
|
||||||
|
|
||||||
|
(no description)
|
||||||
|
|
||||||
|
**Type**:
|
||||||
|
|
||||||
|
```console
|
||||||
|
string
|
||||||
|
```
|
||||||
|
|
||||||
|
**Default value**:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
"Hello world!"
|
||||||
|
```
|
||||||
|
````
|
||||||
|
|
@ -43,6 +43,7 @@ in
|
||||||
{"Creating Nixlets" = "creation.md";}
|
{"Creating Nixlets" = "creation.md";}
|
||||||
{"Packaging" = "packaging.md";}
|
{"Packaging" = "packaging.md";}
|
||||||
{"Usage" = "usage.md";}
|
{"Usage" = "usage.md";}
|
||||||
|
{"Generating Docs" = "generating_docs.md";}
|
||||||
{"Secrets" = "secrets.md";}
|
{"Secrets" = "secrets.md";}
|
||||||
];
|
];
|
||||||
markdown_extensions = [
|
markdown_extensions = [
|
||||||
|
|
|
||||||
6
nix/repo/flake.lock
generated
6
nix/repo/flake.lock
generated
|
|
@ -38,11 +38,11 @@
|
||||||
"nixmkdocs-lib": {
|
"nixmkdocs-lib": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"dir": "lib",
|
"dir": "lib",
|
||||||
"lastModified": 1766000281,
|
"lastModified": 1766062227,
|
||||||
"narHash": "sha256-rtQKu/snzEjZBCyTkZMWUIuvCThtjmVEwBXb6T1mm40=",
|
"narHash": "sha256-jhr5CUi9eDeMIAJn7ayXP8Wr+Y2loV5EhdDIKDkRIdw=",
|
||||||
"owner": "TECHNOFAB",
|
"owner": "TECHNOFAB",
|
||||||
"repo": "nixmkdocs",
|
"repo": "nixmkdocs",
|
||||||
"rev": "6999c026457d7dee3a7ab336cd4d1b38bae77957",
|
"rev": "cb0bb5dc3382e8ba5d81324a2f1fd94ccd5a5df4",
|
||||||
"type": "gitlab"
|
"type": "gitlab"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue