Summary Files Commits Branches @commit @diff @stats
path: root / awk-edits
diff options
context:
space:
mode:
Commit283c31ebf3956eefa23825f72a0a0db1fac64f92 (patch)
Author
 Syndamia <kamen@syndamia.com>
2023-11-17 15:18:32 +0200
Committer
 Syndamia <kamen@syndamia.com>
2023-11-17 15:18:32 +0200
Files5338f5d8b34ee3222513b5a9ee692fbef078aa6d /awk-edits
syndamia.com-283c31ebf3956eefa23825f72a0a0db1fac64f92.tar
syndamia.com-283c31ebf3956eefa23825f72a0a0db1fac64f92.tar.gz
syndamia.com-283c31ebf3956eefa23825f72a0a0db1fac64f92.zip
Parent0f4d19d3cfa721b16a74bfc4ed04b457ebe4b10e (diff)
[styles.css,Heading-anchors] Added a small and big gap before headings in articles
This separated headings with the contents that follow into different "card" or sections
1 files changed, 4 insertions, 2 deletions
-rw-r--r--awk-edits/Heading-anchors.awk6
diff --git a/awk-edits/Heading-anchors.awk b/awk-edits/Heading-anchors.awk
index e3846f9..ee69043 100644
--- a/awk-edits/Heading-anchors.awk
+++ b/awk-edits/Heading-anchors.awk
@@ -7,6 +7,8 @@
# hyperlink is required (except for h1).
/[ \t]*<h[23456]/ {
- match($0, /id="[^"]*"/);
- $0 = $0 ORS "<a class=\"h-anchor\" href=\"#" substr($0, RSTART + 4, RLENGTH - 5) "\" aria-hidden=\"true\">&#x00A7;</a>";
+ match($0, /<h./)
+ headerLevel = (substr($0, RSTART + 2, 1) == 2) ? "" : "-small"
+ match($0, /id="[^"]*"/)
+ $0 = "<div class=\"gap" headerLevel "\"></div>" ORS $0 ORS "<a class=\"h-anchor\" href=\"#" substr($0, RSTART + 4, RLENGTH - 5) "\" aria-hidden=\"true\">&#x00A7;</a>"
}