Sure. I think it’s as easy as adding a few sentences after this portion in section 4.6 to introduce the concept of “compound HTML blocks”:
If the first line meets both the start condition and the end condition, the block may contain just that line.
An end condition may be followed on the same line by optional non-end of line whitespace and then a subsequent start condition for any HTML block type. If so, the HTML block will be continued as a “compound HTML block” until a proper end condition for the new block start condition is met, itself in turn able to be compounded by a start condition trailing its end condition as described above. The extended compound block can then be treated as a single block of raw HTML.
Any single line may have up to one leading end condition iff an HTML block is ongoing and zero to one trailing start conditions. Any single line may also have mutliple start and end condition pairs between its zero to one leading end conditions and zero to one trailing start conditions. Each start/end condition pair will also be treated as part of the compound HTML block.
Your lookahead here remains limited to the end of the line, which isn’t, by one measure, any worse than what you were doing before.
I’ll take another look at the text for precision (you might argue, eg, that, as worded, it does not deal cleanly with the blank line end condition for types 6 & 7), but I think that covers the gist of what would be needed. It is not especially heinous for parsers, and preserves the desire that “For any markup that is not covered by Markdown’s syntax, you simply use HTML itself.” (Luckily, John didn’t mention HTML comments in his list of block types.)