Sections are just sort of there on a page, with no usable distinguishing beginning/endpoints.
We would like to output semantic <section> markup for article sections, but currently are prevented from doing so because sections are not guaranteed to contain balanced content. Any outcome with this is guaranteed to break things.
- Currently skins like minerva and wikihow need to do weird, horribly things for section handling.
- Sections cannot be given labels/ids and only have numbers, which change all the time. (T60541, T116350).
- No internal way to refer to sections besides numbers. (DPL)
We need to determine a path forward with acceptable breakage for major use cases (on-wiki divs, archived discussions, extensions, styled pages, etc), and appropriate fallbacks.
- Run tidy (or the new T89331: Replace HTML4 Tidy in MW parser with an equivalent HTML5 based tool) on each section of an article individually, to ensure that sections are balanced and that it is safe to wrap them with <section> tags.
- Fail out of sectioning when tidy fails too much?
- Break on-wiki styling, but provide better tools?
Per @GWicke, There are two ideas being discussed:
- conservative wrapping: Only consider headings that are direct children of <body> in the first iteration, and don't break up existing DOM structures.
- aggressive wrapping: Break up all structures containing headings, and wrap every heading in its own section.
The "conservative wrapping" approach would be the first step towards a behavior similar to the one @daniel and @matmarex describe. Nested sections for wrapped headings can be added in a later iteration, without breaking up existing DOM structures.