diff --git a/doc/doc-support/package.nix b/doc/doc-support/package.nix index 3cc6daa32863..466beb204425 100644 --- a/doc/doc-support/package.nix +++ b/doc/doc-support/package.nix @@ -116,8 +116,7 @@ stdenvNoCC.mkDerivation ( --script ./highlightjs/loader.js \ --script ./anchor.min.js \ --script ./anchor-use.js \ - --toc-depth 1 \ - --section-toc-depth 1 \ + --sidebar-depth 3 \ manual.md \ out/index.html diff --git a/doc/languages-frameworks/beam.section.md b/doc/languages-frameworks/beam.section.md index 70ad1591be01..db4edaad4a4b 100644 --- a/doc/languages-frameworks/beam.section.md +++ b/doc/languages-frameworks/beam.section.md @@ -125,7 +125,7 @@ There are 2 ways to package backend dependencies: either per-dependency mix2nix When writing an elixir project targeting `mixRelease`, you can also consider using [deps_nix](https://github.com/code-supply/deps_nix) with `mixNixDeps`. `deps_nix` supports git dependencies, but is intended to be added to the project's `mix.exs` directly. -###### mix2nix {#mix2nix} +##### mix2nix {#mix2nix} `mix2nix` is a cli tool available in Nixpkgs. It will generate a Nix expression from a `mix.lock` file. It is quite standard in the 2nix tool series. @@ -175,7 +175,7 @@ If there are git dependencies. You will need to run the build process once to fix the hash to correspond to your new git src. -###### FOD {#fixed-output-derivation} +##### FOD {#fixed-output-derivation} A fixed output derivation will download mix dependencies from the internet. To ensure reproducibility, a hash will be supplied. Note that mix is relatively reproducible. An FOD generating a different hash on each run hasn't been observed (as opposed to npm where the chances are relatively high). See [akkoma](https://github.com/NixOS/nixpkgs/blob/master/pkgs/by-name/ak/akkoma/package.nix) for a usage example of FOD. diff --git a/doc/style.css b/doc/style.css index c3c58e88637d..90517caf4948 100644 --- a/doc/style.css +++ b/doc/style.css @@ -387,15 +387,6 @@ div.appendix dt { margin-top: 1em; } -div.book .toc dt, -div.appendix .toc dt { - margin-top: 0; -} - -.list-of-examples dt { - margin-top: 0; -} - div.book code, div.appendix code { padding: 0; @@ -408,17 +399,6 @@ div.appendix code { hyphens: none; } -div.book div.toc, -div.appendix div.toc { - margin-bottom: 3em; - border-bottom: 0.0625rem solid #d8d8d8; -} - -div.book div.toc dd, -div.appendix div.toc dd { - margin-left: 2em; -} - div.book span.command, div.appendix span.command { font-family: monospace; @@ -515,12 +495,23 @@ nav.toc-sidebar .toc { margin-bottom: 0; } -nav.toc-sidebar .toc dl { +nav.toc-sidebar ol.toc, +nav.toc-sidebar ol.toc ol { + list-style: none; + margin: 0; + padding-left: 0; +} + +nav.toc-sidebar ol.toc ol { + padding-left: 1em; +} + +nav.toc-sidebar li { margin: 0; } -nav.toc-sidebar .toc dd { - margin-left: 1em; +nav.toc-sidebar summary { + cursor: pointer; } @media screen and (min-width: 768px) { diff --git a/nixos/doc/manual/default.nix b/nixos/doc/manual/default.nix index c8afe6167a7d..cf5c28358097 100644 --- a/nixos/doc/manual/default.nix +++ b/nixos/doc/manual/default.nix @@ -201,8 +201,7 @@ rec { --script ./highlightjs/loader.js \ --script ./anchor.min.js \ --script ./anchor-use.js \ - --toc-depth 1 \ - --chunk-toc-depth 1 \ + --sidebar-depth 2 \ ./manual.md \ $dst/${common.indexPath} diff --git a/pkgs/by-name/ni/nixos-render-docs/src/nixos_render_docs/html.py b/pkgs/by-name/ni/nixos-render-docs/src/nixos_render_docs/html.py index 3e4ff1aedb7a..5944431d4680 100644 --- a/pkgs/by-name/ni/nixos-render-docs/src/nixos_render_docs/html.py +++ b/pkgs/by-name/ni/nixos-render-docs/src/nixos_render_docs/html.py @@ -1,12 +1,13 @@ from collections.abc import Mapping, Sequence -from typing import cast, Optional, NamedTuple - from html import escape +from typing import NamedTuple, Optional, cast + from markdown_it.token import Token from .manual_structure import XrefTarget from .md import Renderer + class UnresolvedXrefError(Exception): pass @@ -17,9 +18,6 @@ class Heading(NamedTuple): # special handling for part content: whether partinfo div was already closed from # elsewhere or still needs closing. partintro_closed: bool - # tocs are generated when the heading opens, but have to be emitted into the file - # after the heading titlepage (and maybe partinfo) has been closed. - toc_fragment: str _bullet_list_styles = [ 'disc', 'circle', 'square' ] _ordered_list_styles = [ '1', 'a', 'i', 'A', 'I' ] @@ -29,7 +27,6 @@ class HTMLRenderer(Renderer): _headings: list[Heading] _attrspans: list[str] - _hlevel_offset: int = 0 _bullet_list_nesting: int = 0 _ordered_list_nesting: int = 0 @@ -185,8 +182,7 @@ class HTMLRenderer(Renderer): anchor = f'id="{escape(anchor, True)}"' result = self._close_headings(hlevel) tag = self._heading_tag(token, tokens, i) - toc_fragment = self._build_toc(tokens, i) - self._headings.append(Heading(tag, hlevel, htag, tag != 'part', toc_fragment)) + self._headings.append(Heading(tag, hlevel, htag, tag != 'part')) return ( f'{result}' f'
List of {kind}
' - f'Table of Contents
' if print_title else "", - f'