From 1b3413cc39b255d705737100fb7de5d0ebbf6e1b Mon Sep 17 00:00:00 2001 From: Bottersnike Date: Wed, 29 Dec 2021 01:55:43 +0000 Subject: [PATCH] Pilcrows --- docs.py | 3 +++ headers.js | 10 ++++++++++ styles.css | 26 ++++++++++++++++++++++++++ templates/base.html | 1 + 4 files changed, 40 insertions(+) create mode 100644 headers.js diff --git a/docs.py b/docs.py index 0780d64..2b4108d 100644 --- a/docs.py +++ b/docs.py @@ -52,6 +52,9 @@ def styles(): @app.route("/tango.css") def tango(): return send_from_directory(".", "tango.css") +@app.route("/headers.js") +def header_script(): + return send_from_directory(".", "headers.js") for i in STATIC: diff --git a/headers.js b/headers.js new file mode 100644 index 0000000..c5d44c5 --- /dev/null +++ b/headers.js @@ -0,0 +1,10 @@ +for (const el of document.querySelectorAll("[id]")) { + el.classList.add("haspara") + const pilcrow = document.createElement("a"); + pilcrow.className = "pilcrow" + pilcrow.href = "#" + el.id; + pilcrow.innerHTML = "¶" + el.prepend(pilcrow) +} + +console.log(hasId); diff --git a/styles.css b/styles.css index 7d4a4cf..5b50cb4 100644 --- a/styles.css +++ b/styles.css @@ -82,6 +82,7 @@ pre>code, .highlight { pre>.highlight { margin-bottom: -16px; } + .highlight>pre { margin: 0; } @@ -110,8 +111,33 @@ table.nav { padding-right: 1px; padding-bottom: 1px; } + table.nav td { display: inline-block; margin-right: -1px; margin-bottom: -1px; } + +.haspara { + position: relative; +} + +.haspara:hover .pilcrow { + opacity: 1; +} + +.pilcrow { + position: absolute; + right: calc(100%); + padding-right: 4px; + top: .1em; + font-size: .9em; + text-decoration: none; + opacity: 0; + color: #e68aa2; +} + +.pilcrow:hover { + opacity: 1; + color: #c7254e; +} \ No newline at end of file diff --git a/templates/base.html b/templates/base.html index 0710184..f7a2284 100644 --- a/templates/base.html +++ b/templates/base.html @@ -30,6 +30,7 @@ {% block body %}{% endblock %} + \ No newline at end of file