commonmark/commonmark-spec

HTML comment tags break Markdown list indentation.

Opened this issue · 2 comments

  1. To reproduce

    0. placeholder
    
    	text
    
    0. placeholder
    
    	text
    
    0. placeholder
    
    	text
    
    	0. placeholder
    
    		text
    
    	0. placeholder
    
    		text
    
    	0. placeholder
    
    		text
    
    		0. placeholder
    
    			text
    
    		0. placeholder
    
    			text
    
    		0. placeholder
    
    			text
    
    0. placeholder
    
    	text
    
    <!--
    
    0. placeholder
    
    	text
    
    -->
    
    0. placeholder
    
    	text
    
    	0. placeholder
    
    		text
    
    	<!--
    
    	0. placeholder
    
    		text
    
    	-->
    
    	0. placeholder
    
    		text
    
    		0. placeholder
    
    			text
    
    		<!--
    
    		0. placeholder
    
    			text
    
    		-->
    
    		0. placeholder
    
    			text

    (scroll) produces

    image

    in microsoft/vscode#186232 (comment), which is obviously wrong.

  2. Alternatives

    I can't use

    <!--- -->

    (per https://stackoverflow.com/a/4829998/9731176) since https://github.com/microsoft/vscode/ doesn't render them using whatever https://github.com/commonmark/commonmark-spec/ -compliant engine it uses.

  3. Origin

    Due to https://talk.commonmark.org/t/html-comment-tags-break-markdown-list-indentation/4459/2?u=rokejulianlockhart, reported here.

wooorm commented

This is something people depend on to break adjacent lists (with CM you can now also do that by using a different bullet, as in . or ), but not all other markdown flavors support that)

The current user expectation is that block-level HTML content participates in the container hierarchy like any other block element. For example, an unindented HTML table is expected to be placed in the document root container, interrupting any preceding list just as the unindented HTML comment above does.

The OP's requested behavior would require special-casing HTML comments.

Not to mention upgrading HTML's role in Markdown, which I don't think is a good idea and goes against both the original and current intent.