about summary refs log tree commit diff stats
path: root/adapter/format
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-08-11 13:56:45 +0200
committerbptato <nincsnevem662@gmail.com>2024-08-11 13:56:45 +0200
commit77aaafba20fd354625985bd65dce046cab759c63 (patch)
tree49b8b287a65e4520b442be90c39d6a60464d190d /adapter/format
parentfd31a6691e8553bc782c31d695af1d6ee4811c41 (diff)
downloadchawan-77aaafba20fd354625985bd65dce046cab759c63.tar.gz
md2html: label headings with their level
like sr.ht does
Diffstat (limited to 'adapter/format')
-rw-r--r--adapter/format/md2html.nim3
1 files changed, 2 insertions, 1 deletions
diff --git a/adapter/format/md2html.nim b/adapter/format/md2html.nim
index 4c3fcaa3..5d06acc5 100644
--- a/adapter/format/md2html.nim
+++ b/adapter/format/md2html.nim
@@ -209,7 +209,8 @@ proc parseHash(line: openArray[char]): bool =
       break
   H = max(L - 1, H)
   let id = line.toOpenArray(L, H).getId()
-  stdout.write("<H" & $n & " id='" & id & "'>")
+  stdout.write("<H" & $n & " id='" & id & "'><A HREF='#" & id & "'>" &
+    '#'.repeat(n) & "</A> ")
   line.toOpenArray(L, H).parseInline()
   stdout.write("</H" & $n & ">\n")
   return true