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

nixos-render-docs: add support for examples #220116

Merged
merged 2 commits into from
May 3, 2023
Merged

nixos-render-docs: add support for examples #220116

merged 2 commits into from
May 3, 2023

Conversation

pennae
Copy link
Contributor

@pennae pennae commented Mar 8, 2023

Description of changes

add support for real examples with toc entries (≍ docbook <example>). the module chapter conversion removed a few examples that can new be restored, and the remaining manual chapters have their examples adjusted to include proper titles for toc purposes. this will also be needed if the nixpkgs manual ever decides to use nrd, its lib section is full of examples that make sense to mark up properly.

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 23.05 Release Notes (or backporting 22.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

@github-actions github-actions bot added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: documentation 8.has: module (update) This PR changes an existing module in `nixos/` labels Mar 8, 2023
@pennae pennae requested a review from jtojnar March 11, 2023 07:09
@@ -13,7 +13,7 @@ checking for entire option trees, it is only recommended for use in
submodules.

::: {#ex-freeform-module .example}
**Example: Freeform submodule**
### Freeform submodule
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the example is self-contained, could we just use # to mark the title?

Copy link
Contributor Author

@pennae pennae Mar 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could (and the parser will recognize it all the same), we just used three for visuals. any heading will work, including the headings with = or - underlines.

@pennae
Copy link
Contributor Author

pennae commented Mar 11, 2023

it's important to note that we emit not html, but xhtml. the nixos homepage (and nixos-search to some extent too, apparently) run their own xslt stylesheets on rendered manuals. we can move to html5 only once all of those have either migrated to other methods or had their specifics integrated into nrd somehow.

@nixos-discourse
Copy link

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

https://discourse.nixos.org/t/2023-03-23-documentation-team-meeting-notes-35/26651/1

@nixos-discourse
Copy link

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

https://discourse.nixos.org/t/2023-04-11-documentation-team-meeting-notes-40/27261/1

Copy link
Contributor

@fricklerhandwerk fricklerhandwerk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the code for its inner workings. Phew, I'm sorry you had to go through that, this whole docBook compat is a nightmare. Looks really clean within the constraints though, haven't tested building and trust that it works as advertised.

pennae added 2 commits May 3, 2023 17:59
the nixos manual contains enough examples to support them as a proper
toc entity with specialized rendering, and if in the future the nixpkgs
wants to use nixos-render-docs we will definitely have to support them.
this also allows us to restore some examples that were lost in previous
translation steps because there were too few to add renderer support
back then.
these examples were turned into untitle anchors previously because at
the time supporting examples was not deemed necessary or useful. now
that we have them we can restore them though.
@pennae
Copy link
Contributor Author

pennae commented May 3, 2023

rebased onto current master since it's been a hot minute. output still looks good, going to merge if ci passes.

@pennae pennae merged commit aad2529 into NixOS:master May 3, 2023
@pennae pennae deleted the nrd-example-support branch May 3, 2023 17:58
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 8.has: documentation 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 1-10 10.rebuild-darwin: 1 10.rebuild-linux: 1-10
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

5 participants