about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNgô Ngọc Đức Huy <huyngo@disroot.org>2023-08-04 20:58:50 +0700
committerNgô Ngọc Đức Huy <huyngo@disroot.org>2023-08-04 20:58:59 +0700
commit70704b634dbb8b1ec71423ef88502ba667d91fb1 (patch)
tree63601ed91ca4f6990e537a77bdfd285f19f2fdeb
parentf3331d5172bd711d5cd6a4978b85d1cef9d7e355 (diff)
downloadvictor-70704b634dbb8b1ec71423ef88502ba667d91fb1.tar.gz
Add link to headings
-rw-r--r--assets/css/theme.css6
-rw-r--r--layouts/_default/_markup/render-heading.html6
2 files changed, 11 insertions, 1 deletions
diff --git a/assets/css/theme.css b/assets/css/theme.css
index 22400e9..1c10e99 100644
--- a/assets/css/theme.css
+++ b/assets/css/theme.css
@@ -55,6 +55,10 @@ a.nav-next::before {
     content: "← "
 }
 
-.toc-collapse {
+h2, .toc-collapse {
     text-align: initial;
 }
+
+h2::before, h3::before, h4::before, h5::before, h6::before {
+    content: "§ ";
+}
diff --git a/layouts/_default/_markup/render-heading.html b/layouts/_default/_markup/render-heading.html
new file mode 100644
index 0000000..bf2eb5b
--- /dev/null
+++ b/layouts/_default/_markup/render-heading.html
@@ -0,0 +1,6 @@
+{{ $id := .Anchor | safeURL }}
+<h{{ .Level }} id="{{ $id }}">
+<a class="heading-anchor" href="#{{ $id }}">
+	{{ .Text | safeHTML }}
+</a>
+</h{{ .Level }}>