Minor fixes.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
diff --git a/md4c/md4c.c b/md4c/md4c.c
index 224c416..b95e887 100644
--- a/md4c/md4c.c
+++ b/md4c/md4c.c
@@ -1555,6 +1555,13 @@ redo_indentation_after_blockquote_mark:
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;
+
+ /* Some end conditions serve as blank lines at the same time. */
+ if(ISNEWLINE(off)) {
+ line->type = MD_LINE_BLANK;
+ line->indent = 0;
+ goto done;
+ }
}
line->type = MD_LINE_HTML;
@@ -1575,9 +1582,7 @@ redo_indentation_after_blockquote_mark:
}
/* Check whether we are indented code line.
- * Note indented code block cannot interrupt paragraph.
- * Keep this is as the first check after the blank line: The checks below
- * then do not need to verify that indentation < 4. */
+ * Note indented code block cannot interrupt paragraph. */
if((pivot_line->type == MD_LINE_BLANK || pivot_line->type == MD_LINE_INDENTEDCODE)
&& line->indent >= ctx->code_indent_offset)
{
@@ -1588,7 +1593,7 @@ redo_indentation_after_blockquote_mark:
/* Check whether we are ATX header.
* (We check the indentation to fix http://spec.commonmark.org/0.26/#example-40) */
- if(line->indent < 4 && CH(off) == _T('#')) {
+ if(line->indent < ctx->code_indent_offset && CH(off) == _T('#')) {
if(md_is_atxheader_line(ctx, off, &line->beg, &off) == 0) {
line->type = MD_LINE_ATXHEADER;
goto done;
@@ -1596,7 +1601,7 @@ redo_indentation_after_blockquote_mark:
}
/* Check whether we are Setext underline. */
- if(line->indent < 4 && pivot_line->type == MD_LINE_TEXT
+ if(line->indent < ctx->code_indent_offset && pivot_line->type == MD_LINE_TEXT
&& line->quote_level == pivot_line->quote_level
&& (CH(off) == _T('=') || CH(off) == _T('-')))
{
@@ -1609,7 +1614,7 @@ redo_indentation_after_blockquote_mark:
/* Check whether we are thematic break line.
* (We check the indentation to fix http://spec.commonmark.org/0.26/#example-19)
* (Keep this after check for Setext underline as that one has higher priority). */
- if(line->indent < 4 && ISANYOF(off, _T("-_*"))) {
+ if(line->indent < ctx->code_indent_offset && ISANYOF(off, _T("-_*"))) {
if(md_is_hr_line(ctx, off, &off) == 0) {
line->type = MD_LINE_HR;
goto done;
@@ -1626,7 +1631,9 @@ redo_indentation_after_blockquote_mark:
}
/* Check whether we are start of raw HTML block. */
- if(CH(off) == _T('<') && !(ctx->r.flags & MD_FLAG_NOHTMLBLOCKS)) {
+ if(CH(off) == _T('<') && !(ctx->r.flags & MD_FLAG_NOHTMLBLOCKS)
+ && line->indent < ctx->code_indent_offset)
+ {
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. */