Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix leave callback not called for HTML block comment.
For the specific case of a one-line block comment (HTML block type 2) not followed by a blank line[1], MD4C fails to call the leave callback. Consequently, if another HTML comment follows the first comment, both end up being combined into a single block instead of staying as two separate blocks, each with its own callback. [1] In my comments to issue mity#200 I remarked that the spec doesn't require a blank line to close a type 2 HTML block. DETAILS I can't think of a simple way to demonstrate this issue using md2html alone, precisely because the lack of something can't be shown. Feeding md2html the following markdown: ``` <!-- C1 --> <!-- C2 --> ``` outputs the input text so one would be inclined to think that everything is correct. However, what can't be seen is that there is no callback between lines C1 and C2, while there should be one. Instead, a callback after line C2 wrongly combines the two single-line blocks into a two-line block. Trace the code or add printf statements as needed to see the issue at work. This commit fixes the problem by setting `ctx->html_block_type` to a negative value as a special way to flag this end-of-block case.
- Loading branch information