Skip to content

Commit

Permalink
Add Declared in field to the docs with link to the source on github
Browse files Browse the repository at this point in the history
  • Loading branch information
thelegy committed Dec 16, 2023
1 parent ce4ba80 commit 4dc96b6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions docs/docs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ with lib; let
];
codeBlock = code: "```\n${code}\n```";
fieldName = name: "<div class=\"fieldname\">${name}</div>\n";
modulePath = path: head (strings.match "/nix/store/[^/]+/(.*)" path);
renderOptionDoc = name: option: ''
### ${escapeXML name}
Expand All @@ -90,6 +91,14 @@ with lib; let
${renderCode option.example}
''}
${fieldName "Declared in"}
${flip concatMapStrings option.declarations (x: ''
<a href="https://github.com/${owner}/${repo}/blob/main/${modulePath x}" target="_blank">${modulePath x}</a>
'')}
</div>
'';
in (mapAttrs renderOptionDoc optionsDocParsed);
Expand Down

0 comments on commit 4dc96b6

Please sign in to comment.