Fenced setext headings


#1

Some people traditionally not only underlined their headings, as in setext, but also overlined them. They never relied solely on the overline.

========
Heading
========

--------
Heading
--------

Classic Markdown does not really support this, but for the second level, the preceding line of Hyphen-Minus characters - is turned into a thematic break, i.e. a horizontal line, <hr> in HTML. I believe parsers should have an option to suppress such breaks that directly precede a heading. This should probably not be part of the core specification, except that maybe lines of equal signs should also make a thematic break.

********
Heading
========

________
Heading
--------

PS: I have previously suggested that thematic breaks, including = lines, could be reused for sectioning and pagination. I have also suggested a stricter generalization of markup characters that would also affect bullet lists.


Horizontal rules as (hierarchical) section breaks etc
#2

I have seen these being referenced to as flower box headings and boxed headings.


#3

There is a discussion about adding Flowerbox headings to CommonMark in this topic:

This seems like a good feature to add to a Markdown successor language. I’m not sure how much value there is making this a CommonMark extension given that it will break existing documents and mainly exists for aesthetics.


#4

An extension could collapse an underlined heading with a preceding thematic break and (optionally) deduce special meaning from that.

-------       *******       _______
Heading       Heading       Heading
=======       =======       =======

-------       *******       _______
Heading       Heading       Heading
-------       -------       -------

An extension could also collapse thematic breaks that occur directly before or directly after a prefixed (or suffixed) heading.

-----------     ***********     ___________
# Heading #     # Heading #     # Heading #
-----------     -----------     -----------

-----------     ***********     ___________
# Heading #     # Heading #     # Heading #
***********     ***********     ***********

-----------     ***********     ___________
# Heading #     # Heading #     # Heading #
___________     ___________     ___________

These fall back gracefully to thematic breaks, but most of them are not visually pleasing in source view.

Other types we would need to defer to Commonmark 2.0 or whatever.

=======
Heading
=======

PS: One needs to take care if starting a document with a second-level flowerbox heading that uses only hyphens in environments that support YAML document metadata, because this is surrounded by triple-hyphen fences ---.