diff options
-rw-r--r-- | src/blocks.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/blocks.c b/src/blocks.c index 2ac7032..5b38116 100644 --- a/src/blocks.c +++ b/src/blocks.c @@ -420,17 +420,17 @@ extern node_block *stmd_parse_document(const unsigned char *buffer, size_t len) static void chop_trailing_hashtags(chunk *ch) { - int n; + int n, orig_n; chunk_rtrim(ch); - n = ch->len - 1; + orig_n = n = ch->len - 1; // if string ends in #s, remove these: while (n >= 0 && peek_at(ch, n) == '#') n--; // the last # was escaped, so we include it. - if (n >= 0 && peek_at(ch, n) == '\\') + if (n != orig_n && n >= 0 && peek_at(ch, n) == '\\') n++; ch->len = n + 1; |