diff --git a/Makefile b/Makefile index 857216d..ea9885f 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,6 @@ clean: rm -f index.html index.html: index.md template.html Makefile - pandoc -s --css reset.css --css index.css -i $< -o $@ --template=template.html + pandoc --toc -s --css reset.css --css index.css -i $< -o $@ --template=template.html .PHONY: all clean diff --git a/index.css b/index.css index 7b34a90..e5968aa 100644 --- a/index.css +++ b/index.css @@ -268,7 +268,7 @@ li { /* DEBUG UTILITIES */ -.grid { +.debug .grid { --color: color-mix(in srgb, var(--text-color) 10%, var(--background-color) 90%); position: absolute; top: 0; @@ -281,10 +281,15 @@ li { repeating-linear-gradient(90deg, var(--color) 0 1px, transparent 1px 100%); background-size: 1ch var(--line-height); margin: 0; - - /*display: none;*/ } -.off-grid { +.debug .off-grid { background: rgba(255, 0, 0, 0.1); } + +.debug-toggle { + position: absolute; + top: 0; + right: 0; + margin: var(--line-height) 2ch; +} diff --git a/index.js b/index.js index b3c4bb1..b4d6e95 100644 --- a/index.js +++ b/index.js @@ -52,7 +52,7 @@ function checkOffsets() { const config = { childList: true, subtree: true }; const callback = () => { - const elements = document.querySelectorAll("body *"); + const elements = document.querySelectorAll("body :not(.grid)"); for (const element of elements) { const offset = element.offsetTop % 10; if(element.offsetParent == document.body && offset > 0) { @@ -71,3 +71,8 @@ function checkOffsets() { } window.addEventListener("load", checkOffsets); + +const debugButton = document.querySelector(".debug-toggle"); +debugButton.addEventListener("click", () => { + document.body.classList.toggle("debug"); +}); diff --git a/index.md b/index.md index fb7aa12..86d4d6c 100644 --- a/index.md +++ b/index.md @@ -3,6 +3,7 @@ title: The Monospace Web author: Oskar Wickström date: August 2024 lang: en +toc-title: Contents --- ## Introduction diff --git a/template.html b/template.html index 12ae3f1..3a1e771 100644 --- a/template.html +++ b/template.html @@ -67,6 +67,7 @@ $for(include-after)$ $include-after$ $endfor$
+