Define Headings endings

# Issue
Markdown headings do not end until an other heading of the same level or higher is defined.
This introduces some structure issues, especially for coding developers who look at text structure in a different way.

# Showcase
This text is written into the "Showcase" heading "namespace"/"layer".
## Heading 2:
This other text is written into "Heading  2" namespace.
In order to end this Heading 2 namspace i have to create an other heading of the same level (2) or higher (1).
But to remain into the "Showcase" heading level i have to create a new heading 2.

## Heading 2.1:
By doing this, this new text will be included uner Heading 2.1 namespace, so the "Heading 2" namespace ended.
NOW, if i want to go back to write into "Showcase" namespace then i am not able to do it cause all the text that i am going to write next, will be under the "Heading 2.1" namespace.

# Conclusion
This "issue" creates structural and logical confusion (think about having to manage with lot of concatenated headings).

# Other observation
There should also be a ***setting*** to be added into markdown language: 
the chance of being able to indent / tabulate all the text under a heading in order to improve the text-structure readability, like it's done into coding editors.
For example, in the text i've wrote till now, Heading 2 and Heading 2.1 should be indented inside "Showcase" in order to let the structure of "Showcase" be more readable.

Thank you.

This has come up before.

Markdown is for human text and supports structures used in normal human text. It is not a programming language, a layout engine, or a data format. Markdown is not intended to be the text version of “Turing Complete”.

In human text, headings demarcate sections and subsections. The only way one terminates a section in human text is to start a new one, whether same, lower or higher level. This is not a limitation. It is the nature of linear text flows and works this way because it is less confusing for human readers. You can prove me wrong by linking to one example of a book, essay, academic paper or technical documentation where the text flow drops into a sub section and then pops back out to the parent or root section without starting a new section (Is this what you mean by “manage with lot of concatenated headings”?). I don’t know what you mean by “structural and logical confusion”. All the kinds of writing I just mentioned have used headings that work exactly how Markdown headings work for at least hundreds of years.

Or could you please link to an example showing how “coding developers who look at text structure in a different way”? You haven’t explained what you’re trying to do. Maybe this is an XY problem.

There are cases in natural human text where one drops into a nested item and later pops back out to the parent:

  • nested lists (supported by Markdown)
  • nested text blocks (supported by Markdown block quotes, fenced code blocks, and indented code blocks)

So if you are trying to shoehorn your coding developer use case into prose-oriented Markdown, perhaps you should one of those. Otherwise you might want to look at a more machine/data oriented format like XML or YAML.

My latest conclusion was this:

I don’t know if anyone ever wrote an extension for a CM parser to implement this. I doubt it would ever be included as part of the core syntax.

@Crissov, I give you the same challenge:

Yes, i know a HTML <section> supports this but even there I challenge you to find an example of where it is used that way. I think it’s supported by accident, an artifact of HTML’s XML-derived syntax (closing tags). Even if you find one, see if you can see that structure in the browser rendering. Unless the rendering/CSS applies borders, shading or indentation, it cannot show the end of a section without starting a new one, just like Markdown.

I think this also is trying to make Markdown behave like HTML/XML, whether or not it has any practical use.

In books, dream sequences, flashbacks etc. are frequently ended (and, less frequently, opened) by something like a horizontal line or sequence of asterisks. That’s basically an anonymous subchapter.

When you supply a link to examples as I requested, that shows such a break being more than a thematic break and somehow representing a nesting hierarchy, we can continue to discuss.