Skip to content

Commit 4dc96b6

Browse files
committed
Add Declared in field to the docs with link to the source on github
1 parent ce4ba80 commit 4dc96b6

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

docs/docs.nix

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ with lib; let
6464
];
6565
codeBlock = code: "```\n${code}\n```";
6666
fieldName = name: "<div class=\"fieldname\">${name}</div>\n";
67+
modulePath = path: head (strings.match "/nix/store/[^/]+/(.*)" path);
6768
renderOptionDoc = name: option: ''
6869
### ${escapeXML name}
6970
@@ -90,6 +91,14 @@ with lib; let
9091
${renderCode option.example}
9192
''}
9293
94+
95+
${fieldName "Declared in"}
96+
${flip concatMapStrings option.declarations (x: ''
97+
98+
<a href="https://github.com/${owner}/${repo}/blob/main/${modulePath x}" target="_blank">${modulePath x}</a>
99+
100+
'')}
101+
93102
</div>
94103
'';
95104
in (mapAttrs renderOptionDoc optionsDocParsed);

0 commit comments

Comments
 (0)