dishmint / Markdown2WL

Lex and Parse Markdown in Wolfram Language
MIT License
13 stars 2 forks source link

Don't hardcode indentation-length for space characters in regex rules #23

Closed dishmint closed 1 year ago

dishmint commented 1 year ago

The \\s{2} could be a problem if people use different indentation-lengths.

(* OrderedListItems *)
    RegularExpression[ "^((\\s{2}|\\t)*)((\\d\\.)+\\d?)\\s(.*)$" ] :> $TokenLevelData[ <| "Token" -> "OrderedListItem", "Level" -> GetIndentationLevel["$1"], "Data" -> "$5" |> ]

There are three possibilities: (1) set the indentation-length with an option, (2) set the indentation-length per flavor, or (3) normalize all leading indentation to spaces or tabs

https://github.com/dishmint/Markdown2WL/blob/7c60e2b17cc9b9def708f8e7239637e70bd3d6b2/FaizonZaman/WLMarkdown/Kernel/TokenRules.wl#L22

dishmint commented 1 year ago

I've added $MarkdownIndentationSize so this can be set if needed.