13

HTML has a six level header system for document organization. The idea being that the <h1> level should have the page name, with <h2> subsections underneath. If further subsections are needed there are <h3>, <h4>, <h5>, and <h6>. So you could have some thing like

<h1>Page Name</h1>
  <h2>Sub-section</h2>
    <h3>Sub-sub-section</h3>
      <h4>Sub-sub-sub-section</h4>
        <h5>Sub-sub-sub-sub-section</h5>
          <h6>Sub-sub-sub-sub-sub-section</h6>
    <h3>Sub-sub-section 2</h3>

This provides a nice hierarchical organization. Stack Exchange sort of supports headers, but it's entirely manual. And for some reason, two of the markdowns create <h1> and <h2> headers, even in answers. So if people use the markdown as follows

Section 1
=========
Sub-section 1
-------------
Sub-section 2
-------------

If in the question body, we'd get

<h1>Question?</h1>
   <h1>Section 1</h1>
     <h2>Sub-section 1</h2>
     <h2>Sub-section 2</h2>
   <h2>COUNT Answers</h2>

and if in an answer, we'd see

<h1>Question?</h1>
  <h2>COUNT Answers</h2>
    <h1>Section 1</h1>
      <h2>Sub-section 1</h2>
      <h2>Sub-section 2</h2>

Eek! Either of those is wrong.

Note: I'm skipping a lot of content for brevity's sake. Presumably most people aren't composing their questions or answers entirely of headers. I'm leaving out the paragraphs, divs, etc.

So rather than have === and --- make h1 and h2 headers, could they instead be h2 and h3 in question bodies and h3 and h4 in answers?

Similarly, can you do one of the following:

  • Demote #, ##, ###, and #### to <h3>, <h4>, <h5>, and <h6> in answers?
  • Or demote # and ## to <h3> in answers and leave the others as is?

Either should change questions as well, but # would become <h2> instead of <h3> in questions.

The first better preserves the existing hierarchy while the second better preserves the intentions of people who currently use <h3> headers to denote top level sections of answers. Either would tend to lead to a lot of markdown being slightly wrong, as one preserves semantics while the other preserves display.

Note: a side issue is that search engine optimization works best if there is only one h1 per page and it has the same content as the page <title>.

Examples of problems that arise in the current system:

Note that both those problems would be fixed by this proposal. No one would use an <h1> or <h2> tag via markdown in an answer anymore.

5
  • 1
    search engine optimization works best as if there is an issue with Stack Overflow content being indexed by Google now.
    – rene
    Dec 27 '15 at 9:42
  • @rene Perhaps there is -- on pages where h1 headers are used for something other than the question. That many pages are well optimized doesn't mean that all of them are.
    – Brythan
    Dec 27 '15 at 14:01
  • Your proposal would require that h1 and h2 are expelled from being used in the markdown editor or that their current meaning is changed, something the upcoming spec for commanmark was going to fix.
    – rene
    Dec 27 '15 at 14:10
  • I agree that it requires either expelling them or changing their meaning. I don't agree that the linked spec for CommonMark fixes the problems noted here. Nor would I say that StackExchange should support the standard even when it conflicts with StackExchange's design. That would seem more a reason to pick one fix over another.
    – Brythan
    Dec 27 '15 at 22:57
  • Well, Balpha is one of the co-authors of the commonmark spec and I believe feature owner on SE for PageDown and Markdownsharp. I expect them to implement and adhere that spec for their posts. I still see no major benefit in fixing or implementing your proposal.
    – rene
    Dec 27 '15 at 23:07

You must log in to answer this question.

Browse other questions tagged .