# Define Headings endings

**URL:** <https://talk.commonmark.org/t/define-headings-endings/4698>\
**Category:** Spec\
**Created:** [July 9, 2024, 11:24pm UTC](https://talk.commonmark.org/t/define-headings-endings/4698 "2024-07-09T23:24:10Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Quantum\_Py](https://talk.commonmark.org/user_avatar/talk.commonmark.org/quantum_py/32/2983_2.png) [@Quantum\_Py](https://talk.commonmark.org/u/Quantum_Py)\
**Post date:** [July 9, 2024, 11:24pm UTC](https://talk.commonmark.org/t/define-headings-endings/4698/1 "2024-07-09T23:24:10Z")

</div>

```auto
# 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.

```

---

<div class="post-metadata">

**Author:** ![vas](https://talk.commonmark.org/user_avatar/talk.commonmark.org/vas/32/1267_2.png) [@vas](https://talk.commonmark.org/u/vas)\
**Post date:** [July 10, 2024, 6:59am UTC](https://talk.commonmark.org/t/define-headings-endings/4698/2 "2024-07-10T06:59:23Z")

</div>

[This has come up before.](https://talk.commonmark.org/t/whats-a-good-way-to-go-up-one-header-section/3979)

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](https://xyproblem.info).

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.

---

<div class="post-metadata">

**Author:** ![Crissov](https://talk.commonmark.org/user_avatar/talk.commonmark.org/crissov/32/1455_2.png) [@Crissov](https://talk.commonmark.org/u/Crissov)\
**Post date:** [July 10, 2024, 4:48pm UTC](https://talk.commonmark.org/t/define-headings-endings/4698/3 "2024-07-10T16:48:36Z")

</div>

My latest conclusion was this:

> [@Horizontal rules as (hierarchical) section breaks etc](https://talk.commonmark.org/t/horizontal-rules-as-hierarchical-section-breaks-etc/1241/3):
>
> - `----`: empty heading `section` break – continue in new anonymous sibling section
> - ` **** `: structural `section` break – continue in parent section afterwards
> - ` ____ `: visual `hr` break

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.

---

<div class="post-metadata">

**Author:** ![vas](https://talk.commonmark.org/user_avatar/talk.commonmark.org/vas/32/1267_2.png) [@vas](https://talk.commonmark.org/u/vas)\
**Post date:** [July 11, 2024, 11:39am UTC](https://talk.commonmark.org/t/define-headings-endings/4698/4 "2024-07-11T11:39:23Z")

</div>

> [@Horizontal rules as (hierarchical) section breaks etc](https://talk.commonmark.org/t/horizontal-rules-as-hierarchical-section-breaks-etc/1241/3):
>
> ` **** `: structural `section` break – continue in parent section afterwards

@Crissov, I give you the same challenge:

> [@vas](#):
>
> 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_.

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.

> [@Horizontal rules as (hierarchical) section breaks etc](https://talk.commonmark.org/t/horizontal-rules-as-hierarchical-section-breaks-etc/1241/3):
>
> `----`: empty heading `section` break – continue in new anonymous sibling section

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

---

<div class="post-metadata">

**Author:** ![Crissov](https://talk.commonmark.org/user_avatar/talk.commonmark.org/crissov/32/1455_2.png) [@Crissov](https://talk.commonmark.org/u/Crissov)\
**Post date:** [July 12, 2024, 8:58am UTC](https://talk.commonmark.org/t/define-headings-endings/4698/5 "2024-07-12T08:58:30Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![vas](https://talk.commonmark.org/user_avatar/talk.commonmark.org/vas/32/1267_2.png) [@vas](https://talk.commonmark.org/u/vas)\
**Post date:** [July 15, 2024, 5:26pm UTC](https://talk.commonmark.org/t/define-headings-endings/4698/6 "2024-07-15T17:26:33Z")

</div>

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.
