Skip to content

Commit 59145c5

Browse files
committed
docs: add heading anchors
1 parent df647aa commit 59145c5

File tree

6 files changed

+49
-32
lines changed

6 files changed

+49
-32
lines changed

docs/manual/CONTRIBUTING.md

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
# Contributing
1+
# Contributing {#contributing}
22

33
[commitizen]: https://github.com/commitizen-tools/commitizen
44
[article from GeeksforGeeks]: https://www.geeksforgeeks.org/how-to-create-a-new-branch-in-git/
55
[creating a PR]: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request
66
[documentation on forking repositories]: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/fork-a-repo
77
[documentation on reviewing PRs]: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/reviewing-proposed-changes-in-a-pull-request
8-
[Core Principles]: #core-principles
8+
[Core Principles]: #ch-core-principles
99
[testing documentation]: ./TESTING.html
10-
[reviewed]: #reviewing-a-pr
10+
[reviewed]: #ch-reviewing-a-pr
1111
[REVIEWING.md]: ./REVIEWING.html
1212

1313
Hjem Rum (or HJR) is always in need of contributions as a module collection. As
@@ -21,7 +21,7 @@ If you are familiar with contributing to open source software, you can safely
2121
skip ahead to [Core Principles]. Otherwise, read the following section to learn
2222
how to fork a repo and open a PR.
2323

24-
## Getting Started
24+
## Getting Started {#ch-getting-started}
2525

2626
To begin contributing to HJR, you will first need to create a fork off of the
2727
main branch in order to make changes. For info on how to do this, we recommend
@@ -33,7 +33,7 @@ from your fork. To do so, you can read this [article from GeeksforGeeks] that
3333
will also explain branches for you. Don't worry too much about the technical
3434
details, the most important thing is to make and switch to a branch from HEAD.
3535

36-
### Commit format
36+
### Commit Format {#sec-commit-format}
3737

3838
> [!TIP]
3939
> Our dev shell allows for interactive commits, through the means of
@@ -77,7 +77,7 @@ After you have setup a PR, it will be [reviewed] by maintainers and changes may
7777
be requested. Make the changes requested and eventually it will likely be
7878
accepted and merged into main.
7979

80-
## Core Principles
80+
## Core Principles {#ch-core-principles}
8181

8282
In creating HJR, we had a few principles in mind for development:
8383

@@ -88,13 +88,13 @@ In creating HJR, we had a few principles in mind for development:
8888
Please keep these in mind as you read through our general guidelines for
8989
contributing.
9090

91-
## Guidelines
91+
## Guidelines {#ch-guidelines}
9292

9393
These guidelines, are, of course, merely guidelines. There are and will continue
9494
to be exceptions. However, do your best to stick to them, and keep in mind that
9595
reviewers will hold you to them as much as possible.
9696

97-
### Aliases
97+
### Aliases {#sec-aliases}
9898

9999
At the top of any module, there should always be a `let ... in` set. Within
100100
this, functions should have their location aliased, cfg should be aliased, and
@@ -132,7 +132,7 @@ and `type`, so the alias name is just `toml`.
132132
Always be sure to include `cfg` that links to the point where options are
133133
configured by the user.
134134

135-
### Writing Options
135+
### Writing Options {#sec-writing-options}
136136

137137
Writing new options is the core of any new module. It is also the easiest place
138138
to blunder. As stated above, a core principle of HJR is to minimize the number
@@ -254,7 +254,7 @@ default. This can also be used in `mkOption`, but it is more common to use it in
254254
If you do not set this, the docs builder will break due to not knowing how to
255255
resolve the reference to `config`.
256256

257-
### Conditionals in Modules
257+
### Conditionals in Modules {#sec-conditionals-in-modules}
258258

259259
Always use a `mkIf` before the `config` section. Example:
260260

@@ -366,7 +366,7 @@ First, the file is only written if any of the options to write to the file are
366366
set. `optionalString` is then used to compile each option's results in an
367367
optimized and clean way.
368368

369-
### Extending RumLib
369+
### Extending RumLib {#sec-extending-rumlib}
370370

371371
Rather than having functions scattered throughout the module collection, we
372372
would rather keep our directories organized and purposeful. Therefore, all
@@ -394,7 +394,7 @@ Additionally, please follow how lib is structured in Nixpkgs. For example, the
394394
custom function `attrsNamesHasPrefix` is under `attrsets` to signify that it
395395
operates on an attribute set, just like in Nixpkgs.
396396

397-
### Docs
397+
### Docs {#sec-docs}
398398

399399
If you would like to contribute to our documentation, we ask a few things of
400400
you:
@@ -430,12 +430,30 @@ Make sure to use {file}`lib.options.mkEnableOption`, like is done in
430430
If you do not do it like this, the link check on the docs will fail, since our
431431
docs generator will attempt to make hyperlinks out of those function names.
432432

433-
### Tests
433+
Headers should always have an anchor with them to ensure the link checker can
434+
follow header links at time of build. Follow these examples, and you should find
435+
it simple:
436+
437+
```md
438+
# My new document page {#my-new-document-page}
439+
440+
## My 1st chapter heading! {#ch-my-1st-chapter-heading}
441+
442+
### WHAT_DI-887-NI-DO>????? WRONG ? my cool section! {#sec-what-di-887-ni-do-wrong-my-cool-section}
443+
```
444+
445+
Words should be separated by `-`, special characters should be removed, numbers
446+
are fine to keep, extra spaces should be removed, everything should be lower
447+
caps, first headings have no prefix, second headings have `ch` prefix, third
448+
headings have `sec` prefix, etc. If you're unsure, just give it your best shot
449+
and a reviewer will make sure it's as it should be.
450+
451+
### Tests {#sec-tests}
434452

435453
Please refer to the [testing documentation] for more information on how tests
436454
work.
437455

438-
## Reviewing a PR
456+
## Reviewing a PR {#ch-reviewing-a-pr}
439457

440458
Even if you do not have write-access, you can always leave a review on someone
441459
else's PR. Again, GitHub has great [documentation on reviewing PRs]. This is

docs/manual/INSTALLATION.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
# Installing Hjem Rum
1+
# Installing Hjem Rum {#installing-hjem-rum}
22

33
Welcome to Hjem Rum. Installing and configuring Hjem Rum is as easy as any other
44
module.
55

6-
## Importing the Hjem Rum Flake
6+
## Importing the Hjem Rum Flake {#ch-importing-the-hjem-rum-flake}
77

88
To begin using Hjem Rum, simply add and import Hjem and Hjem Rum into your
99
flake:
@@ -44,7 +44,7 @@ outputs = {
4444
}
4545
```
4646

47-
## Important Hjem Settings
47+
## Important Hjem Settings {#ch-important-hjem-settings}
4848

4949
Be sure to first set the necessary settings for Hjem and import Hjem Rum's Hjem
5050
module from the input:
@@ -67,7 +67,7 @@ hjem = {
6767
};
6868
```
6969

70-
## Configuring Hjem Rum Modules
70+
## Configuring Hjem Rum Modules {#ch-configuring-the-hjem-rum-modules}
7171

7272
You can then configure any of the options defined in this flake in any nix
7373
module:

docs/manual/QUIRKS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Quirks, Tips, & Tricks
1+
# Quirks, Tips, & Tricks {#quirks-tips-tricks}
22

33
[#17]: https://github.com/snugnug/hjem-rum/issues/17
44

@@ -10,7 +10,7 @@ serving only as a module collection on top of Hjem.
1010
To help alleviate this, here are some of those quirks that you may find, as well
1111
as some tips to help you on your journey with Hjem Rum.
1212

13-
## Environmental Variables
13+
## Environmental Variables {#ch-environmental-variables}
1414

1515
Hjem provides the option {option}`environment.sessionVariables` allowing the
1616
user to set environmental variables to be sourced. However, Hjem does not have

docs/manual/REVIEWING.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
# Review tips
1+
# Review Tips {#review-tips}
22

33
[Code Review Antipatterns]: https://www.chiark.greenend.org.uk/~sgtatham/quasiblog/code-review-antipatterns/
44
[nixpkgs]: https://github.com/NixOS/nixpkgs
55
[SNUG Discord server]: https://discord.gg/6rMPtKDKzt
6-
[multi-trip reviews]: #2-single-trip-reviews
6+
[multi-trip reviews]: #ch-2-single-trip-reviews
77

88
An often overlooked part of contributing to an open source project is proper
99
review practices. It's very easy to alienate contributors with bad code review.
@@ -18,7 +18,7 @@ tips serve as a reference, not a rule of law.
1818
<sub>Much of this guide is inspired by [Code Review Antipatterns] by Simon
1919
Tatham. If you're interested, give it a look! </sub>
2020

21-
## 1. Be nice
21+
## 1. Be nice {#ch-1-be-nice}
2222

2323
Starting off with an easy one! However, there's actually something meaningful to
2424
be said here. As a reviewer, it's easy to get frustrated with constantly giving
@@ -34,7 +34,7 @@ This might sound silly at first. But when it feels like a reviewer is _on your
3434
side_, it makes a huge difference. If this tone feels a little foreign, pretend
3535
you're writing an email, and that should give you a good barometer.
3636

37-
## 2. Single-trip reviews
37+
## 2. Single-trip reviews {#ch-2-single-trip-reviews}
3838

3939
As a contributor, it can be frustrating to finish accommodating all the review
4040
comments, only to immediately be given a bunch of other suggestions, which
@@ -59,7 +59,7 @@ something will require a lot of changes to be mergeable, be up-front about
5959
it―even if you feel a little guilty. Better to rip the bandaid off now, than to
6060
leave it on for a few review sessions.
6161

62-
## 3. United front
62+
## 3. United front {#ch-3-united-front}
6363

6464
Anyone who's contributed to [nixpkgs] knows the cycle―you've accommodated one
6565
reviewer's comments, only for a different reviewer to come in with MORE things
@@ -70,7 +70,7 @@ When possible, try to coordinate review feedback. The [SNUG Discord server] is a
7070
great place for working together to ensure feedback is clear and consistent
7171
between reviewers.
7272

73-
## 4. Bikeshedding
73+
## 4. Bikeshedding {#ch-4-bikeshedding}
7474

7575
Have you ever made a PR, only for every single line to be criticized for not
7676
being done exactly how the reviewer wants? It feels like your code is being held
@@ -108,7 +108,7 @@ Maybe, if it's a stylistic change, say:
108108

109109
> Stylistic nitpick, but could you maybe change this to ____? Not blocking.
110110
111-
# Extending this document
111+
# Extending this document {#extending-this-document}
112112

113113
If you find yourself experiencing something as a contributor that makes you less
114114
motivated to contribute―whether it's for Hjem Rum or some other project―feel

docs/manual/TESTING.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Testing setup for modules
1+
# Testing setup for modules {#testing-setup-for-module}
22

33
[nushell test module]: https://github.com/snugnug/hjem-rum/blob/main/modules/tests/programs/nushell.nix
44
[nix.dev provides a useful guide]: https://nix.dev/tutorials/nixos/integration-testing-using-virtual-machines.html
@@ -11,7 +11,7 @@ from other testing frameworks and stick with `runTest`, from the
1111
abstractions in regards to writing the tests, so they should be written just
1212
like any other test that uses the NixOS Test Driver.
1313

14-
## Creating Tests
14+
## Creating Tests {#ch-creating-tests}
1515

1616
Every file is automatically imported with
1717
{file}`lib.filesystem.listFilesRecursive`, given that there is a check output
@@ -29,7 +29,7 @@ checks = hjem-rum-services = import ./modules/tests (mkCheckArgs ./modules/tests
2929
# Just // (import ./modules/tests and pass mkCheckArgs with your brand-new directory to it.
3030
```
3131

32-
### Naming
32+
### Naming {#sec-naming}
3333

3434
To reduce CI run time, we only run checks for which the module or test file has
3535
changed. For this association to work, the following naming scheme has to be
@@ -47,7 +47,7 @@ start with the aformentioned pattern, such as `programs-foot-test-plugins`.
4747
> [!IMPORTANT]
4848
> If you do not follow this rule, your tests will not be run during CI.
4949
50-
## Writing Tests
50+
## Writing Tests {#ch-writing-tests}
5151

5252
Tests for Hjem Rum are written just like any other test, so it might be worth to
5353
take a read at how NixOS tests work. [nix.dev provides a useful guide], as does

docs/package.nix

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@
116116
--manpage-urls ${./manpage-urls.json} \
117117
--options-depth 3 \
118118
--generate-search true \
119-
--template-dir ${./templates} \
120119
--input-dir ${./manual} \
121120
--output-dir "$out"
122121

0 commit comments

Comments
 (0)