From c906166374d0ce921b2c49d60b41288424414a47 Mon Sep 17 00:00:00 2001 From: bptato Date: Mon, 3 Jun 2024 20:28:38 +0200 Subject: md2html: include numbers in ids --- adapter/format/md2html.nim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'adapter/format/md2html.nim') 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 == ':': -- cgit 1.4.1-2-gfad0