md4c

C Markdown parser. Fast. SAX-like interface. Compliant to CommonMark specification.
git clone https://noulin.net/git/md4c.git
Log | Files | Refs | README | LICENSE

commit 1a88b298b6aeeaaad3a5052494aac33fe1c4bc69
parent a0be9834f4f2b54273ec473b226ef97bb7144b25
Author: Martin Mitas <mity@morous.org>
Date:   Tue,  4 Oct 2016 21:52:04 +0200

md_analyze_line: Fix detection of one-line HTML block.

Diffstat:
Mmd4c/md4c.c | 8+++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/md4c/md4c.c b/md4c/md4c.c @@ -93,7 +93,7 @@ struct MD_CTX_tag { OFF code_fence_info_end; /* For MD_BLOCK_HTML. */ - unsigned html_block_type; + int html_block_type; }; typedef enum MD_LINETYPE_tag MD_LINETYPE; @@ -795,6 +795,12 @@ redo_indentation_after_blockquote_mark: if(CH(off) == _T('<') && !(ctx->r.flags & MD_FLAG_NOHTMLBLOCKS)) { ctx->html_block_type = md_is_html_block_start_condition(ctx, off); if(ctx->html_block_type > 0) { + /* The line itself also may immediately close the block. */ + if(md_is_html_block_end_condition(ctx, off) == ctx->html_block_type) { + /* Make sure this is the last line of the block. */ + ctx->html_block_type = 0; + } + line->type = MD_LINE_HTML; goto done; }