nixdoc icon indicating copy to clipboard operation
nixdoc copied to clipboard

Section headings from comments at top of files

Open tazjin opened this issue 6 years ago • 1 comments

Currently sections (i.e. the "groups" of functions, strings, lists etc.) generated by nixdoc don't have any descriptions other than what the user specifies on the CLI.

Some files (for example lib/debug.nix) have multi-line comments at the beginning that could be interpreted as section headings.

Implementation wise, the rnix parser will probably attach those as meta to the very first AST node which should be relatively easy to check for.

tazjin avatar Oct 28 '18 18:10 tazjin

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/how-to-generate-documentation-from-arbitrary-nix-code/22292/8

nixos-discourse avatar Oct 11 '22 11:10 nixos-discourse

@zmitchell is interested to pick this up

fricklerhandwerk avatar Apr 06 '23 16:04 fricklerhandwerk

Note that before adding any complex features like this depending on parser output, the parser should be upgraded. nixdoc is using a very old version of rnix, and the API has nothing to do with the current one anymore - the longer that isn't done, the harder it will be eventually if more things are built on the old API.

tazjin avatar Apr 06 '23 16:04 tazjin

Right, is that what's happening here? https://github.com/nix-community/nixdoc/pull/36

zmitchell avatar Apr 06 '23 16:04 zmitchell

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/2023-04-06-documentation-team-meeting-notes-39/27048/1

nixos-discourse avatar Apr 06 '23 16:04 nixos-discourse

I ran to this and pushed a quick implementation to https://github.com/nix-community/nixdoc/pull/70 . It's naive w.r.t to white-space handling and passes the string on without parsing or so, so once currently looses the section headings. On the plus side it's a trivial implementation.

phaer avatar Aug 31 '23 16:08 phaer

This is now implemented with #70!

infinisil avatar Nov 17 '23 22:11 infinisil