Markdown specifications aren‘t clear about the interaction between a hard line-break and a heading, so implementations differ. For compatibility, you should add an empty line before and after the heading. If you don’t then hard line-breaks can be used to split headings over multiple lines as shown by the tests below.
See also heading examples.
See the hard line-break test file.
TEST atx-style headings ...
RESULT there are three headings comprising two lines each.
TEST settext-style headings ...
RESULT there are two headings comprising two lines each.