-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Systematize builtins.fetchTree
docs
#9732
base: master
Are you sure you want to change the base?
Conversation
This seems more productive than what I've been up to with a self-documenting codec abstraction, which may be too ambitious for something in C++. |
7c5e178
to
23476d8
Compare
cc8c940
to
a330689
Compare
OK @roberth @fricklerhandwerk @infinisil the infra here is now set up! Not sure whether we want to
|
builtins.fetchTree
docsbuiltins.fetchTree
docs
80aae23
to
d4e9043
Compare
I vote to merge as is, and agree it's a useful step forward. But I sigh loudly as well because it's adding notable tech debt. Now we have 5 (!) mechanisms for producing documentation:
Especially the additional document composition code path makes it substantially more messy. The ideal end state for me would be documentation living exclusively in C++ headers (with plain markdown files for optional free-form blurbs) and processing structured output – templating and such – happening exclusively in the Nix language, decoupled from building the all of Nix. Currently it's hacks on top of hacks and it takes forever to compile. |
I agree there are too many. I would like to replace the stuff we do with the interpreter inside Nix with this method, because then it will work with the store-only Nix. |
That would make it a lot harder to contribute to for most people, and I don't see why docs can't be built by a full Nix as a separate step, but let's discuss it somewhere else. |
Discussed during the maintainers meeting today. Deferred for the time being
Decision: Defer until commonmark/cmark#362 (comment) gets an answer. The the plan is to
|
Personally I want to state that such style of documentation for CLI tools is worst-case - it is neither man nor help, you're forcing user to pipe output to pager and leaving out man convetions (no one interested in following them because "help files" is written in Markdown, and typical markdown user is rarely even avare of existence of manual pages, and their conventions). Not to mention that you're forcing user to execute your command in order to get help (rather than "viewing static files" with man). (From here: commonmark/cmark#362). |
Lowdown represents one local optimum, where it's responsible for the whole pipeline. This is insufficient, as described by tribals just now. Another optimum is one where we have
In this scenario, we've got rid of
Do we want capable documentation tooling? If so, what are the steps to bridge the optima? Adding cmark could be step one, but we should only take it if we agree on such a vision. |
For yet another optimum, we could consider minimizing the documentation related code in Nix, and generate the documentation as well as some code from a single source that isn't C++. I do think we eventually want nice expression printing and such, so it feels like #9817 might be a detour. |
Personally I, again, would recommend to move from Markdown (it is not Holly Graal) to something more suitable for writing documentation, eg. https://gitlab.com/ddevault/scdoc/-/blob/master/scdoc.5.scd Please note that I'm random outsider, brought to this issue by accident, so don't take my musings for granted. I have rare experience with Nix, and want to state that CLI tooling was one reason why I switched to Guix. |
The Nix ecosystem has by and large switch to markdown in order to make writing easier, reasoning that lowering the contribution threshold leads to more end user improvements than fancy features such as table captions. Indeed we have recognized that it is not the Holy Grail, and we've decided that retrieving that artifact is not feasible, and focus on things that matter more. However, it is a fact that markdown is of little use when writing highly structured documentation, such as manpages. It needs to be embedded in something richer, and/or it needs to be extended with custom syntax, like we do in Nixpkgs Markdown, with e.g. |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/2024-01-25-documentation-team-meeting-notes-106/38792/1 |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/2024-01-19-nix-team-meeting-minutes-116/38837/1 |
I can remove the patch now that commonmark/cmark#524 is merged --- thanks CMark maintainers! But I still need to do something about replacing lowdown. |
d4e9043
to
b861457
Compare
As I suspected, cmark wasn't interested in accepting 2000 more lines of C from lowdown, which means there is not an immediate path to getting rid of the lowdown dependency. I would still like to merge this as is, however:
|
b861457
to
22112c1
Compare
`cmark` is a more robust library for constructing Markdown than `lowdown`. It is also more portable. Unfortunately it doesn't have a terminal mode, so we cannot get rid of lowdown yet. The `--enable-markdown` flag is renamed to `--enable-lowdown` accordingly.
Needed until commonmark/cmark#524 is released. • Added input 'cmark': 'github:commonmark/cmark/cd37711b8a08da67ba4e21a42614b86dd8def929' (2024-01-26)
The renaming task is splatting everything together into markdown lists. The docs are temporily not rendered.
22112c1
to
f66a761
Compare
Motivation
The renaming task is splatting everything together into markdown lists. I use
cmark
to then assemble everyting together into Markdown.Context
I tried using
lowdown
's AST first, but there were just too many issues, most significantly thatlowdown
doesn't actually support rendering back to markdown, which is needed for the manual (mdbook renders in that case).PR #9273 should be able to improve upon this a good bit, but I think it is still a useful stepping stone.
Priorities and Process
Add 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.