Skip to content

Conversation

@drupol
Copy link
Contributor

@drupol drupol commented Apr 20, 2025

This PR:

  • Is a better and updated version of ci: add a check workflow on documentation #396914
  • Add a new check nixpkgs-manual.tests.check-formatting (541861cefb2be3dbdc5702f57fdc470f0751bd16) using prettier
  • Manually reformat some parts of the documentation to make it standard compliant with Markdown (3e924224a5235ff29013f5de667a5653cb4d9895, 77f7f186dd971b86850b02c0e6726ee25aba0575, cd5e67f8e908dd88344e69347ff680a6933520ed)
  • Enable Python code blocks reformatting (c82b948efabee3e6c69fcc6b6380f303fd91efc1) thanks to markdown-code-runner
  • Reformat the whole doc/ directory with prettier (822d5fc7bc48ce31005c50c081379bc425d78687)

⚠️ About definition lists

The most controversial point is the handling of definition lists, commonly written as:

Term
: Definition of the term

This format is part of what is referred to as “Markdown Extended” 1, but it is not part of the original or CommonMark specification. As a result, tools like prettier, which are widely adopted for Markdown formatting, do support basic definition lists, but they fail to preserve structure when those lists are nested.

Example: Nested definition list before and after Prettier formatting

Before:

Term 1
: Definition of term 1
  Term 2
  : Definition of term 2

After:

Term 1
: Definition of term 1
Term 2
: Definition of term 2

Try it in the Prettier playground

I agree that these nested definitions add meaningful structure. Unfortunately, there is currently no way to configure prettier to preserve this structure or disable this specific behavior.

The compromise solution

Rather than remove these lists or leave them unformatted (which would fail the automated check), I chose to preserve the meaning and pass prettier formatting by wrapping nested definitions in bullet points.

Rewritten as list items: preserves meaning, passes Prettier

Before:

- Term 1
  : Definition of term 1
  - Term 2
    : Definition of term 2

After (identical output):

- Term 1
  : Definition of term 1
  - Term 2
    : Definition of term 2

Try it in the Prettier playground

This way:

  • We retain all content and structure, including nesting.
  • Formatting is consistent and passes checks.
  • No manual work is needed to maintain consistency going forward.

Commit 3ae1d6b28ab0833b17f1b06c4ed499a0e86da72a applies the above compromise and updates the documentation accordingly. As seen in the screenshots hereunder, the generated HTML is slightly different, I would argue that the readability and clarity have improved.

Simple example (before, after)

screenshot

Example with nested definition list (before, after)

image

Let me know what you think! And if you disagree, perhaps it's worth considering a compromise so that we can benefit from an automated documentation checking system. The trade-off may well be worth it: would you rather rely on nested definition lists that aren't really standard and lose automation and checks, or accept a small compromise and gain all of that?

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • 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/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 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.

Add a 👍 reaction to pull requests you find important.

@github-actions github-actions bot added 6.topic: python Python is a high-level, general-purpose programming language. 6.topic: GNOME GNOME desktop environment and its underlying platform 6.topic: haskell General-purpose, statically typed, purely functional programming language 6.topic: rust General-purpose programming language emphasizing performance, type safety, and concurrency. 6.topic: golang Go is a high-level general purpose programming language that is statically typed and compiled. 6.topic: ruby A dynamic, open source programming language with a focus on simplicity and productivity. 6.topic: vim Advanced text editor 6.topic: erlang General-purpose, concurrent, functional high-level programming language 6.topic: ocaml OCaml is a general-purpose, high-level, multi-paradigm programming language. 6.topic: nodejs Node.js is a free, open-source, cross-platform JavaScript runtime environment 6.topic: TeX Issues regarding texlive and TeX in general 6.topic: agda A dependently typed programming language / interactive theorem prover 6.topic: java Including JDK, tooling, other languages, other VMs 6.topic: nim Nim programing language 6.topic: zig Zig is an imperative, general-purpose, statically typed, compiled system programming language. 6.topic: julia Julia is a high-level, high-performance dynamic language for technical computing. 6.topic: dotnet Language: .NET 8.has: documentation This PR adds or changes documentation 6.topic: policy discussion Discuss policies to work in and around Nixpkgs labels Apr 20, 2025
@drupol drupol requested a review from fricklerhandwerk April 20, 2025 18:27
@drupol drupol force-pushed the push-zxsvwylrppyn branch from 0564f98 to 324bc43 Compare April 20, 2025 18:30
@github-actions github-actions bot added 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels Apr 20, 2025
@drupol

This comment was marked as resolved.

@drupol drupol force-pushed the push-zxsvwylrppyn branch from ba91f9d to f944481 Compare April 20, 2025 18:47
doc/README.md Outdated
Copy link
Contributor

Choose a reason for hiding this comment

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

This is wrong. It's supposed to be a term-definition in the paragraph that is part of the outer definition.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think nested term-definition are officially supported in markdown. #investigating

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added a - (list item), would it be acceptable for you?

Copy link
Contributor Author

@drupol drupol Apr 21, 2025

Choose a reason for hiding this comment

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

I guess I can mark this as resolved as I updated the current documentation before doing the formatting so that this issue won't happen again. Hope it's OK now.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hm that seems to be a deficiency of any given markdown implementation (there's no such thing as "official" markdown). The semantics is valid DOM, so in a sense "not our problem". Making it a list item defies the original purpose.

It also seems inappropriate to iron over the work of @DanielSidhion and others who have put effort into adding more structure, just because some tool happens not to know that structure. This may appear like a minor thing, but I think it's sort of at the heart of what we're doing with Nixpkgs: we're building a knowledge base, and that's a big data structure. Removing information because some tools can't handle it seems wrong.

Is it possible to disable that particular behavior? Since the other changes look alright (haven't checked everything).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right I hear you and fully agree. I'll write a post describing precisely what has been done so far to fix this issue at the end of the day, with screenshots and detailed explanation so we can decide what to do about this.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks a lot @drupol!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I updated the OP with full details, explanation and screenshots. Let me know what you think.

@drupol drupol force-pushed the push-zxsvwylrppyn branch 3 times, most recently from 12ae0c0 to 3ff1b23 Compare April 21, 2025 06:07
@github-actions github-actions bot added 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. and removed 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels May 11, 2025
@drupol drupol force-pushed the push-zxsvwylrppyn branch from 487eb03 to 96f21c7 Compare May 11, 2025 20:56
@github-actions github-actions bot added 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. and removed 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. labels May 11, 2025
@drupol drupol force-pushed the push-zxsvwylrppyn branch 2 times, most recently from 019dba9 to 029f3a4 Compare May 11, 2025 21:09
@wegank wegank added the 2.status: merge conflict This PR has merge conflicts with the target branch label May 17, 2025
drupol added 6 commits May 19, 2025 19:48
commands:

```
redirects rename-identifier module-system-lib-evalModules-return-value-_configurationClass module-system-lib-evalModules-return-value--configurationClass
redirects rename-identifier module-system-lib-evalModules-return-value-_module module-system-lib-evalModules-return-value--module
redirects rename-identifier module-system-lib-evalModules-return-value-_type module-system-lib-evalModules-return-value--type
```
command: `cd doc; prettier --write .`
@drupol drupol force-pushed the push-zxsvwylrppyn branch from 029f3a4 to 1a11195 Compare May 19, 2025 17:50
@ofborg ofborg bot removed the 2.status: merge conflict This PR has merge conflicts with the target branch label May 19, 2025
@wegank wegank added the 2.status: merge conflict This PR has merge conflicts with the target branch label Jun 9, 2025
@drupol drupol closed this Aug 24, 2025
@drupol drupol deleted the push-zxsvwylrppyn branch August 24, 2025 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2.status: merge conflict This PR has merge conflicts with the target branch 6.topic: agda A dependently typed programming language / interactive theorem prover 6.topic: dotnet Language: .NET 6.topic: erlang General-purpose, concurrent, functional high-level programming language 6.topic: GNOME GNOME desktop environment and its underlying platform 6.topic: golang Go is a high-level general purpose programming language that is statically typed and compiled. 6.topic: haskell General-purpose, statically typed, purely functional programming language 6.topic: java Including JDK, tooling, other languages, other VMs 6.topic: julia Julia is a high-level, high-performance dynamic language for technical computing. 6.topic: nim Nim programing language 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 6.topic: nodejs Node.js is a free, open-source, cross-platform JavaScript runtime environment 6.topic: ocaml OCaml is a general-purpose, high-level, multi-paradigm programming language. 6.topic: policy discussion Discuss policies to work in and around Nixpkgs 6.topic: python Python is a high-level, general-purpose programming language. 6.topic: ruby A dynamic, open source programming language with a focus on simplicity and productivity. 6.topic: rust General-purpose programming language emphasizing performance, type safety, and concurrency. 6.topic: TeX Issues regarding texlive and TeX in general 6.topic: vim Advanced text editor 6.topic: zig Zig is an imperative, general-purpose, statically typed, compiled system programming language. 8.has: documentation This PR adds or changes documentation 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants