aboutsummaryrefslogtreecommitdiff
path: root/layouts
diff options
context:
space:
mode:
authorNicholas Johnson <nick@nicholasjohnson.ch>2023-11-03 00:00:00 +0000
committerNicholas Johnson <nick@nicholasjohnson.ch>2023-11-03 00:00:00 +0000
commitac7486160b8a322abfa14fbe97cae4a6a1b7be81a7c9f80dfe3d7e43d2e8b429 (patch)
tree886d37e281744ab89101c04530529e76e0c03ca4e7c33df77043cf088dec2aec /layouts
parent324f7ead1c9333c8580277316ae9f620dfed3d715e805b5f824d6fe4da15567e (diff)
downloadhugo-theme-journal-ac7486160b8a322abfa14fbe97cae4a6a1b7be81a7c9f80dfe3d7e43d2e8b429.tar.gz
hugo-theme-journal-ac7486160b8a322abfa14fbe97cae4a6a1b7be81a7c9f80dfe3d7e43d2e8b429.zip
Use superscripted reference numbers for links
The implementation is ugly, but I couldn't find another way to accomplish this.
Diffstat (limited to 'layouts')
-rw-r--r--layouts/_default/single.gmi16
1 files changed, 14 insertions, 2 deletions
diff --git a/layouts/_default/single.gmi b/layouts/_default/single.gmi
index 94b7c62..b566ff3 100644
--- a/layouts/_default/single.gmi
+++ b/layouts/_default/single.gmi
@@ -41,8 +41,20 @@
{{ $ref_index = add $ref_index 1 -}}
{{ $ref_text := index . 1 -}}
- {{/*- replace link with reference numbers enclosed in brackets */ -}}
- {{ $rendered_text = replace $rendered_text (index . 0) (print $ref_text "[" $ref_index "]") 1 -}}
+ {{/* create superscript of $ref_index */ -}}
+ {{ $ref_index := replace $ref_index "0" "⁰" -}}
+ {{ $ref_index = replace $ref_index "1" "¹" -}}
+ {{ $ref_index = replace $ref_index "2" "²" -}}
+ {{ $ref_index = replace $ref_index "3" "³" -}}
+ {{ $ref_index = replace $ref_index "4" "⁴" -}}
+ {{ $ref_index = replace $ref_index "5" "⁵" -}}
+ {{ $ref_index = replace $ref_index "6" "⁶" -}}
+ {{ $ref_index = replace $ref_index "7" "⁷" -}}
+ {{ $ref_index = replace $ref_index "8" "⁸" -}}
+ {{ $ref_index = replace $ref_index "9" "⁹" -}}
+
+ {{/* replace Markdown links with link text and their superscripted reference numbers */ -}}
+ {{ $rendered_text = replace $rendered_text (index . 0) (print $ref_text $ref_index) 1 -}}
{{ end -}}