all repos — hastyscribe @ 7e292ce4ec22d283db7276cf4e8016664a04e93a

A professional markdown compiler.

Fixed escaping of brackets within code blocks.
h3rald h3rald@h3rald.com
Sat, 21 Apr 2018 18:09:05 +0200
commit

7e292ce4ec22d283db7276cf4e8016664a04e93a

parent

5ea17993dbd82b1d9cd3cc32e7823816c1de0bba

1 files changed, 10 insertions(+), 0 deletions(-)

jump to
M hastyscribe.nimhastyscribe.nim

@@ -300,11 +300,21 @@ else:

warn "Snippet '" & id & "' not defined." result = result.replace(snippet, "") +# Substitute \{ with { *after* preprocessing +proc remove_bracket_escapes(hs: var HastyScribe, document: string): string = + result = document + for lb in document.findAll(peg"'\\{'"): + result = result.replace(lb, "{") + for rb in document.findAll(peg"'\\}'"): + result = result.replace(rb, "}") + + proc preprocess(hs: var HastyScribe, document, dir: string, offset = 0): string = result = hs.parse_transclusions(document, dir, offset) result = hs.parse_fields(result) result = hs.parse_snippets(result) result = hs.parse_macros(result) + result = hs.remove_bracket_escapes(result) # Public API