Skip to content
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

doc: Add support for manpage references #130047

Merged
merged 6 commits into from
Sep 7, 2021
Merged

doc: Add support for manpage references #130047

merged 6 commits into from
Sep 7, 2021

Conversation

jtojnar
Copy link
Member

@jtojnar jtojnar commented Jul 12, 2021

Motivation for this change

NixOS manual, especially its Options appendix often reference UNIX man pages. Unfortunately, unlike DocBook, Markdown does not support such references. But even DocBook’s rendering is not very useful for people not familiar with the foo(volnum) notation (NixOS/nixos-search#327).

First, let’s add support for MyST’s roles, which will allow us to reference it using {manpage}`foo(volnum)` syntax. Second, let’s add a filter that automatically linkifies stuff.

Additionally, since the syntax has been getting out of hand, let’s add a conversion script: maintainers/scripts/db-to-md.sh <file.xml>

What has been done
Related issues

NixOS search issue that triggered this: NixOS/nixos-search#303

Closes: #127394 – Pandoc filter that is now part of the conversion script.

cc @ryantm @blaggacao

Thanks @Kreyren for bringing this to my attention.

@jtojnar jtojnar requested review from edolstra and ryantm as code owners July 12, 2021 20:54
@github-actions github-actions bot added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 6.topic: policy discussion 8.has: documentation This PR adds or changes documentation labels Jul 12, 2021
@jtojnar jtojnar force-pushed the doc-manpage-role branch from f2271cb to c61b3f0 Compare July 12, 2021 20:57
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux labels Jul 12, 2021
@jtojnar jtojnar marked this pull request as draft July 12, 2021 21:20
@ryantm
Copy link
Member

ryantm commented Jul 12, 2021

I'm currently opposed to adding this syntax. Why can't we do this?

[tmpfiles.d(5)](https://www.freedesktop.org/software/systemd/man/tmpfiles.d.html)

Officially, only the manpage role is supported at the moment.

Unlike in rST, the syntax uses braces instead of colons:

    {manpage}`nix.conf(5)`
@jtojnar jtojnar force-pushed the doc-manpage-role branch from c61b3f0 to c44b97d Compare July 13, 2021 00:11
@jtojnar jtojnar force-pushed the doc-manpage-role branch from c44b97d to 7baf180 Compare July 13, 2021 00:24
@jtojnar
Copy link
Member Author

jtojnar commented Jul 13, 2021

As discussed on Matrix, I prefer having the man page reference decoupled from the (optional) on-line target. Especially for option documentation, which is the next area I will be focusing at.

I feel like adding explicit links is too much effort for option description authors – they would have to look for online versions of the man pages. Especially for the common ones (e.g. systemd.time(7)) we could do that automatically, as long as we know about the reference.

The second reason is that I needed some syntax to use by the docbook-to-markdown conversion script. I felt rST roles, or rather MyST syntax are a good choice since we might switch to MyST in the future anyway: #105036

The syntax is quite inobtrusive, renders reasonably on regular CommonMark renderers (GitHub) and if person does not know about it, they can always just omit it.


Rendered:

Documentation for manpage role

@jtojnar jtojnar marked this pull request as ready for review July 13, 2021 00:40
@jtojnar jtojnar merged commit 1e75936 into master Sep 7, 2021
@jtojnar jtojnar deleted the doc-manpage-role branch September 7, 2021 19:29
@jtojnar
Copy link
Member Author

jtojnar commented Sep 7, 2021

Merged as per discussion on Matrix. We can easily improve or remove the syntax in the future if we decide to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 6.topic: policy discussion 8.has: documentation This PR adds or changes documentation 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants