Skip to content

Commit

Permalink
Fix corrupted code block after HTML comment
Browse files Browse the repository at this point in the history
Close mity#200.
  • Loading branch information
step- committed Jan 8, 2024
1 parent 8c5e190 commit 757b282
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/md4c.c
Original file line number Diff line number Diff line change
Expand Up @@ -5985,8 +5985,12 @@ md_analyze_line(MD_CTX* ctx, OFF beg, OFF* p_end,

/* Check for indented code.
* Note indented code block cannot interrupt a paragraph. */
#define HTML_BLOCK_JUST_ENDED \
(pivot_line->type == MD_LINE_HTML && \
ctx->html_block_type <= 0)
if(line->indent >= ctx->code_indent_offset &&
(pivot_line->type == MD_LINE_BLANK || pivot_line->type == MD_LINE_INDENTEDCODE))
(pivot_line->type == MD_LINE_BLANK || pivot_line->type == MD_LINE_INDENTEDCODE || HTML_BLOCK_JUST_ENDED))
#undef HTML_BLOCK_JUST_ENDED
{
line->type = MD_LINE_INDENTEDCODE;
MD_ASSERT(line->indent >= ctx->code_indent_offset);
Expand Down

0 comments on commit 757b282

Please sign in to comment.