-
-
Notifications
You must be signed in to change notification settings - Fork 14
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
Markup syntax in comments #5
Comments
Let's please avoid bikeshedding. This issue is a serious question and the decision will have real consequences. Please also keep in mind that the choice of documentation format will need support from the community in order for this tool to be effective. I am very hopeful about the new RFC process. It seems that the Nix community will be able to actually decide on RFCs more effectively, which is needed. It also seems to be the only way that this decision can be made. For reference, here are some efforts that have stalled due to a lack of decision:
|
Here are my current thoughts on the topic: What we have right nowPeople have over time converged onto a relatively common structure for comments, which is what
Inside of the documentation string at the beginning, some people are currently using Markdown-like syntax, I've seen:
Some open inline code with a backtick, close it with an apostrophe (like in Lisp). In my doc comments updates I've changed those to backtick-only, so for the files I touched it is now consistent. What we actually needWe need to have the following features to support what we can generate right now, and also to do what we want to in the future:
Please extend this list if you can think of more things (cc: @grahamc). I do not think that a complex format that supports all of what DocBook has to offer should be supported in the doc comments. These will be consumed both by people reading the source (so they should read naturally) and the web manual, and they should be writeable without having to learn anything significant.
Prior art & inspirationJust dumping a few things that I can think of, feel free to add more to the list!
Note: This also vaguely relates to nix-community/flake.nix#2 - it would be nice to go in the same direction in both projects for future compatibility. (cc: @shlevy). |
FWIW, for now I'm leaning heavily in the direction of RST for nix-community/flake.nix#2 . It covers the common cases really nicely but has facilities for arbitrarily rich semantics layered on top if we need it. Ultimately though my plan is to defer to the RFC process if/when prototypes have proven their worth and we're ready to go live. |
Here is some interesting discussion from the Rust community about reStructuredText. |
Yeah, in domains where markdown is adequate (which probably holds for the vast majority of docstrings) it's probably the best choice. Good luck to the brave soul who wants to reimplement the nix manuals in it, though 😉 |
I for one want to be very clear that this issue is not about the manual at large, but about docstrings specifically. The manual obviously has very different requirements! 🙃 |
I'm not a fan of RST, which has all the "do what I mean" syntax issues common to all markdown-like languages. (E.g. you have to remember what magic number of spaces causes an indented block, what magic characters introduce a section/subsection/italics etc.) |
@tazjin Yeah, sorry to muddy the waters here. Was just noting that because it collides with nix-community/flake.nix#2 |
This aged well. Considering that the manual is markdown now, am I wrong to assume we don't need to specify anything on top of what we already do in the rest of the manual? |
@roberth The Nix manual was a huge downgrade in some aspects of UX. Compare https://nixos.org/manual/nix/stable/#builtin-fetchGit with https://nixos.org/manual/nix/unstable/expressions/builtins.html – you cannot even link to individual functions any more. So at minimum, we need anchor support. In Nixpkgs manual, we borrowed pandoc’s heading indentifiers (likewise for inline anchors). Additionally, it would be nice to have a better syntax for the actual function descriptions. Currently:
|
No, we don't. The whole point of switching to Markdown is to make it easier to contribute. If we reinvent Docbook markup (poorly, using line noise as markup), then we haven't really gained anything. Generated docs can have anchors though, it's just that we don't want to write them in Markdown. |
Is there anything speaking against using any strict subset of markdown that is already in Nixpkgs? As long as there are no diverging features, people can use common things such as |
This is done now with @pennae's efforts in #40 and NixOS/nixpkgs#239636 🚀 |
(Warning: This thread may contain bikeshedding!)
It would be nice to have support for some markup format in documentation strings. The easiest one that everybody knows is Markdown. It's very easy to use
pulldown-cmark
to implement a custom emitter for the format, too, so this seems very tempting.There are some existing comments that use a slightly different syntax for inline code blocks though:
Maybe it's possible to make this work in the Markdown parser, but if not I think it's probably easier to just change those comments.
The text was updated successfully, but these errors were encountered: