Summary Files Commits Branches @commit @diff @stats
path: root / ext / heading-anchors.awk
diff options
context:
space:
mode:
Commitfe054ac33b1d28ae16dbae9305651188f0b22608 (patch)
Author
 Syndamia <kamen@syndamia.com>
2025-07-20 19:46:45 +0300
Committer
 Syndamia <kamen@syndamia.com>
2025-07-20 19:46:45 +0300
Files390118dfa7ea1cd9a0de4e257198c99585e16fde /ext/heading-anchors.awk
syndamia.com-fe054ac33b1d28ae16dbae9305651188f0b22608.tar
syndamia.com-fe054ac33b1d28ae16dbae9305651188f0b22608.tar.gz
syndamia.com-fe054ac33b1d28ae16dbae9305651188f0b22608.zip
Parentd54c672035ab29b0d392bd7641c83808945ee21b (diff)
feat(src/ext): Implemented a large part of the awk_edits functionality via dunbar
1 files changed, 11 insertions, 0 deletions
-rw-r--r--ext/heading-anchors.awk11
diff --git a/ext/heading-anchors.awk b/ext/heading-anchors.awk
new file mode 100644
index 0000000..42b85a0
--- /dev/null
+++ b/ext/heading-anchors.awk
@@ -0,0 +1,11 @@
+BEGIN {
+ gap = "<div class=\"gap\"></div>" ORS
+ small_gap = "<div class=\"gap-small\"></div>" ORS
+ anchor = ORS "<a class=\"h-anchor\" href=\"#[?header?]\" aria-hidden=\"true\">#</a>"
+
+ define("HEADER2", gap "<h2 id=\"[?header?]\">", "</h2>" anchor)
+ define("HEADER3", small_gap "<h3 id=\"[?header?]\">", "</h3>" anchor)
+ define("HEADER4", small_gap "<h4 id=\"[?header?]\">", "</h4>" anchor)
+ define("HEADER5", small_gap "<h5 id=\"[?header?]\">", "</h5>" anchor)
+ define("HEADER6", small_gap "<h6 id=\"[?header?]\">", "</h6>" anchor)
+}