all repos — hastyscribe @ 1e0eceae8930bc6daca948c19c847a1d25ff692d

A professional markdown compiler.

Check for Pandoc (%) metadata failed if one of the first three document lines was empty
kaminski kaminski@naew.nato.int
Sun, 04 Apr 2021 12:56:50 +0200
commit

1e0eceae8930bc6daca948c19c847a1d25ff692d

parent

8ac9afc750354133311c4020209f8c377187e073

1 files changed, 3 insertions(+), 3 deletions(-)

jump to
M src/hastyscribepkg/markdown.nimsrc/hastyscribepkg/markdown.nim

@@ -149,13 +149,13 @@ # Check if metadata is present

var lns = s.splitLines var valid_metadata = false var offset = 0 - if (lns[0][0] == '%') and (lns[1][0] == '%') and (lns[2][0] == '%'): + if lns[0].startsWith('%') and lns[1].startsWith('%') and lns[2].startsWith('%'): valid_metadata = true else: valid_metadata = false - if lns[0][0] == '%': + if lns[0].startsWith('%'): offset = 2 - if lns[1][0] == '%': + if lns[1].startsWith('%'): offset = 3 var str = cstring(lns[offset..lns.len-1].join("\n")) var mmiot = mkd_string(str, cint(str.len-1), flags)