From 3f47e62a7e96bf820f3195eb811e213f9c1b8f29 Mon Sep 17 00:00:00 2001 From: Alex Baines Date: Sun, 9 May 2021 11:52:16 +0100 Subject: [PATCH] hmmlib2: allow marker as first thing in text node --- hmmlib2/hmmlib.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hmmlib2/hmmlib.h b/hmmlib2/hmmlib.h index 9594dae..cb1f09c 100644 --- a/hmmlib2/hmmlib.h +++ b/hmmlib2/hmmlib.h @@ -586,8 +586,9 @@ static size_t _hmml_parse_text(struct _hmml_parser* p, HMML_Annotation* anno) // it is a @ ~ or : marker without parameters else { - // if next char is a space, or prev char is not a space, then it can't be a marker - if(strchr(" \t\r\n", p->cursor[1]) || !strchr(" \t\r\n", p->cursor[-1])) { + // if next char is a space, or prev char is not a space*, then it can't be a marker + // * unless it's the first char + if(strchr(" \t\r\n", p->cursor[1]) || !(out == text_mem || strchr(" \t\r\n", p->cursor[-1]))) { *out++ = c; ++p->cursor; } else { @@ -796,7 +797,7 @@ void hmml_free(HMML_Output* out) } const struct HMML_Version hmml_version = { - 2, 0, 2 + 2, 0, 3 }; #undef HSTX