As the parser reads it
# Install ## Step 2 ##
<h1>Install</h1>
<h2>Step 2 ##</h2> Edges
- Trailing
#are heading text, so the second heading readsStep 2 ##. - A heading is one line: a backslash at its end is a literal backslash, not a break.
- It ends a paragraph without a blank line before it.
Against CommonMark
ATX only. Setext underlines (===, ---) are gone, and closing # are no longer stripped.