hmmlib2: allow marker as first thing in text node

This commit is contained in:
Alex Baines 2021-05-09 11:52:16 +01:00
parent c911e393d5
commit 3f47e62a7e
1 changed files with 4 additions and 3 deletions

View File

@ -586,8 +586,9 @@ static size_t _hmml_parse_text(struct _hmml_parser* p, HMML_Annotation* anno)
// it is a @ ~ or : marker without parameters // it is a @ ~ or : marker without parameters
else { else {
// if next char is a space, or prev char is not a space, then it can't be a marker // 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])) { // * 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; *out++ = c;
++p->cursor; ++p->cursor;
} else { } else {
@ -796,7 +797,7 @@ void hmml_free(HMML_Output* out)
} }
const struct HMML_Version hmml_version = { const struct HMML_Version hmml_version = {
2, 0, 2 2, 0, 3
}; };
#undef HSTX #undef HSTX