diff options
author | John MacFarlane <jgm@berkeley.edu> | 2014-10-26 12:37:59 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2014-10-26 12:37:59 -0700 |
commit | e618715636a3bd60930bea34d214b3aaf8e9e766 (patch) | |
tree | ea550ce33d20532de1d240c083f997805aeb54d6 /src/blocks.c | |
parent | 9918827edd3dd6630f7417f1efca673bae55e6dd (diff) |
Require space before closing # sequence in ATX header.
Closes #169.
Diffstat (limited to 'src/blocks.c')
-rw-r--r-- | src/blocks.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/blocks.c b/src/blocks.c index ae106d2..7613c82 100644 --- a/src/blocks.c +++ b/src/blocks.c @@ -432,15 +432,15 @@ static void chop_trailing_hashtags(chunk *ch) chunk_rtrim(ch); orig_n = n = ch->len - 1; - // if string ends in #s, remove these: + // if string ends in space followed by #s, remove these: while (n >= 0 && peek_at(ch, n) == '#') n--; - // the last # was escaped, so we include it. - if (n != orig_n && n >= 0 && peek_at(ch, n) == '\\') - n++; - - ch->len = n + 1; + // Check for a be a space before the final #s: + if (n != orig_n && n >= 0 && peek_at(ch, n) == ' ') { + ch->len = n; + chunk_rtrim(ch); + } } // Process one line at a time, modifying a node_block. |