-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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
treewide: markdown option docs #176146
treewide: markdown option docs #176146
Conversation
This fits all the requirements expressed in #175586 at this point, with the exception of @edolstra's dislike of I suppose another potential complaint is that we're using a markdown processor, The implementation looks ok so far. Will give this a try later. Looks like we can finally complete the markdown migration! 🎉
tl;dr not a problem. |
# also keep trailing spaces so we can diff the generated XML to check for | ||
# conversion bugs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Diffing seems like a good idea.
Instead of trying to match every quirk, we can choose to canonicalize both inputs to the diff. We'll need something like that for <filename>
anyway.
we really only chose mistune because it's a commonmark parser available in python that doesn't enlarge the docs closure by too much. anything else that can parse markdown into an ast would be fine. even shelling out to the favored markdown processor and have it dump an ast wouldn't be a problem, we think. |
things we're not sure how to convert:
|
admonitions are indeed possible :) |
updated description to the current state of the patch set. apart from a few kinds of admonitions the conversion script should be mostly complete (if still very experimental). |
does this need more modules converted as examples? 🤔 |
I don't think it helps with review and merge. If you're not confident that others can contribute conversion PRs, you could do some more, but leave them for a follow-up PR. Some documentation will be helpful:
When those are done and it's ready for other to start contributing, I think we're ready for a merge. |
tag = admonitions[kind] | ||
# we don't keep whitespace here because usually we'll contain only | ||
# a single paragraph and the original docbook string is no longer | ||
# available to restore the trailer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean by trailer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trailing whitespace that is not rendered. we keep trailing whitespace at the end of a description to make diffing options.xml
before and after a migration easier, but that isn't possible here. apart from that there is not reason to care about whitespace and if we use a different diffing process we can also remove this whitespace handling entirely.
we've added some documentation to the nixos and nixpkgs manuals clarifying which extensions are available in options docs. not entirely sure which sections to link for the final nixos manual chapter though 😕 |
I was also thinking about documenting the transition process, but it's perhaps better to write an issue for that, similar to the other tracking issues we have, like #24288. |
I've tried it and it worked well. My only findings: if you get invalid xml errors in " |
🍾!
not sure we can do anything about that, unfortunately. though what we probably could do is print a warning (error?) if a level of options is not exclusive |
I'm not sure if it's worth the effort. Option merging is quite rare in NixOS, so I wouldn't expect much trouble from false positives if the error message mentions the possibility. I think it's ok to mention the "bad" error message in the tracking issue. It's a temporary state of affairs anyway, during the transition. |
invalid xml errors are probably most often caused by |
For reasons unknown (to me), I'm getting this:
If I drop all the |
are you backporting newer modules to older revisions? does it work with |
This is admittedly with a custom nixpkgs, but it's building the latest unstable. The problem starting showing about a week ago.
I'll try to create the smallest possible example that reproduces it and let you guys know. In the meantime I'm just patching out |
Description of changes
just an attempt at getting option descriptions to markdown (cf #175586).
the conversion is obviously not completely faithful (since representing the difference between
<filename>
and<literal>
isn't easy to represent in markdown, let alone very useful?), but minimizing the diff between the current options.xml and the one after md conversions is an explicit goal. once all descriptions have been converted we can dropmdDoc
again in a mechanical patch.on top of the syntax extensions the manual already uses this introduces two new ones:
{command}`foo`
and{option}`foo`
. both render to their docbook<tag>foo</tag>
equivalent to keep the conversion between docbook descriptions and md as faithful as possible. in the future we may want to use{option}
to auto-link option uses to their descriptions, but right now{command}
and{option}
have no such special functions.one problem we see with these extensions is that the processor used for the options manual would have to support them, which at least for mddoc seems very hard to achieve at first glance. keeping
{option}
doesn't seem that important, but{command}
is rendered differently from regular literals in the manpage build (so we should probably keep that, somehow). keeping the admonitions also seems very useful, not least because they stand out nicely even in the manpage build.cc @roberth
Things done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)nixos/doc/manual/md-to-db.sh
to update generated release notes