From 621e838f8cd61aef8edc1d9ef387d4a3ced5d18d Mon Sep 17 00:00:00 2001 From: rasmus-kirk Date: Mon, 26 Feb 2024 13:34:15 +0100 Subject: [PATCH] Added link tags --- docs/pandoc/anchor-links.lua | 14 ++++++++++++++ docs/pandoc/link.svg | 5 +++++ docs/pandoc/style.css | 24 ++++++++++++++++++++++++ mkDocs.nix | 5 +++-- nixarr/transmission/default.nix | 2 +- 5 files changed, 47 insertions(+), 3 deletions(-) create mode 100644 docs/pandoc/anchor-links.lua create mode 100644 docs/pandoc/link.svg diff --git a/docs/pandoc/anchor-links.lua b/docs/pandoc/anchor-links.lua new file mode 100644 index 0000000..5bfb350 --- /dev/null +++ b/docs/pandoc/anchor-links.lua @@ -0,0 +1,14 @@ +-- Adds anchor links to headings with IDs. +function Header (h) + if h.identifier ~= '' then + -- an empty link to this header + local anchor_link = pandoc.Link( + {}, -- content + '#' .. h.identifier, -- href + '', -- title + {class = 'anchor', ['aria-hidden'] = 'true'} -- attributes + ) + h.content:insert(1, anchor_link) + return h + end +end diff --git a/docs/pandoc/link.svg b/docs/pandoc/link.svg new file mode 100644 index 0000000..c66ac2d --- /dev/null +++ b/docs/pandoc/link.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/docs/pandoc/style.css b/docs/pandoc/style.css index 5adb0a6..cb54671 100644 --- a/docs/pandoc/style.css +++ b/docs/pandoc/style.css @@ -411,3 +411,27 @@ table td { page-break-after: avoid; } } + +/* show the anchor links in headings if one hovers over the heading. */ +.anchor::before { + content: url("/docs/pandoc/link.svg"); + display: inline-block; + font-size: 1em; + left: -1.5em; + line-height: 1.5; + opacity: 0.15; + position: relative; + width: 0em; +} +.anchor:hover { + text-decoration: none; +} +h1:hover > .anchor::before, +h2:hover > .anchor::before, +h3:hover > .anchor::before, +h4:hover > .anchor::before, +h5:hover > .anchor::before, +h6:hover > .anchor::before { + opacity: 1; +} +/* end: heading anchor links */ diff --git a/mkDocs.nix b/mkDocs.nix index 044d807..d1fd28c 100644 --- a/mkDocs.nix +++ b/mkDocs.nix @@ -62,7 +62,8 @@ in pkgs.stdenv.mkDerivation { --metadata title="Nixarr - Option Documentation" \ --template docs/pandoc/template.html \ --metadata date="$(date -u '+%Y-%m-%d - %H:%M:%S %Z')" \ - --css style.css \ + --css docs/pandoc/style.css \ + --lua-filter docs/pandoc/anchor-links.lua \ -V lang=en \ -V --mathjax \ -f markdown+smart \ @@ -77,7 +78,7 @@ in pkgs.stdenv.mkDerivation { --template docs/pandoc/template.html \ --metadata date="$(date -u '+%Y-%m-%d - %H:%M:%S %Z')" \ --metadata title="Nixarr" \ - --css style.css \ + --css docs/pandoc/style.css \ -V lang=en \ -V --mathjax \ -f markdown+smart \ diff --git a/nixarr/transmission/default.nix b/nixarr/transmission/default.nix index 479fab9..0b555bc 100644 --- a/nixarr/transmission/default.nix +++ b/nixarr/transmission/default.nix @@ -188,7 +188,7 @@ in { watch-dir-enabled = true; watch-dir = "${nixarr.mediaDir}/torrents/.watch"; - rpc-bind-address = "192.168.15.1"; + rpc-bind-address = "127.0.0.1"; rpc-port = cfg.uiPort; rpc-whitelist-enabled = false; rpc-whitelist = "192.168.15.1,127.0.0.1";