about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-06-03 20:28:38 +0200
committerbptato <nincsnevem662@gmail.com>2024-06-03 20:28:38 +0200
commitc906166374d0ce921b2c49d60b41288424414a47 (patch)
tree83525c209be641be2d6238e0b89ef2c1ec8b72a3
parentdfb03387691e72f8832734255765ddfdd38db372 (diff)
downloadchawan-c906166374d0ce921b2c49d60b41288424414a47.tar.gz
md2html: include numbers in ids
-rw-r--r--adapter/format/md2html.nim6
1 files changed, 3 insertions, 3 deletions
diff --git a/adapter/format/md2html.nim b/adapter/format/md2html.nim
index dcc0d495..4c3fcaa3 100644
--- a/adapter/format/md2html.nim
+++ b/adapter/format/md2html.nim
@@ -11,6 +11,8 @@ type BracketState = enum
   bsNone, bsInBracketRef, bsInBracket, bsAfterBracket, bsInParen, bsInImage,
   bsInTag
 
+const AsciiAlphaNumeric = {'0'..'9', 'A'..'Z', 'a'..'z'}
+
 proc getId(line: openArray[char]): string =
   result = ""
   var i = 0
@@ -30,8 +32,7 @@ proc getId(line: openArray[char]): string =
       inc i
       continue
     case c
-    of 'A'..'Z': result &= char(int(c) - int('A') + int('a'))
-    of 'a'..'z', '-', '_', '.': result &= c
+    of AsciiAlphaNumeric, '-', '_', '.': result &= c.toLowerAscii()
     of ' ': result &= '-'
     of '[':
       if bs != bsNone:
@@ -48,7 +49,6 @@ proc getId(line: openArray[char]): string =
 type InlineState = enum
   isItalic, isBold, isCode, isComment, isDel
 
-const AsciiAlphaNumeric = {'0'..'9', 'A'..'Z', 'a'..'z'}
 func startsWithScheme(s: string): bool =
   for i, c in s:
     if i > 0 and c == ':':