diff options
1 files changed, 4 insertions, 2 deletions
| -rw-r--r-- | awk-edits/Heading-anchors.awk | 6 |
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\">§</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\">§</a>" } |