Skip to content

top-level H1 should become titles when no other title is provided as metadata #11660

@cderv

Description

@cderv

This change was intended by

mainly as a fix for breadcrumbs when no title

but also as a first step (HTML only right now) to have h1 considered as title when no title provided.

Citing @cscheid from #11618 (comment) below


We do intend for top-level H1's to become titles.

H1's inside other elements are a different story. I would like to (gently) nudge document authors to use H2s instead of H1s, but mostly because this would make some downstream tooling easier to write. With that said, I don't think we would ever want an "inner" H1 like the one in your document to be interpreted as the document title.

In concrete examples, we want the following two documents to be equivalent to each other:

Document 1:

---
format: html
title: A title
---

Some content

Document 2:

---
format: html
---

# A title

Some content

However, these should not be equivalent to the following Document 3:

---
format: html
---

::: {#a-div}
# A title
:::

Some content

However the change in #11224 has been a bit too agressive and caused undesired regression

So we reverted to apply it only for website right now (#11640)

This is issue is tracking the utlimate aim to have h1 behave as title in the right situations.

Consideration from previous work and discussions

  • title is a metadata that pandoc will use in Pandoc's template. Mainly through our title-block partials. So we probably need to handle this h1 to title promotion in Lua
  • Especially because we manage several different title-block partials that applies in different situation (website, manuscript, bootstrap or not, title banner or not). So doing h1 promotion as post processing (like in add title canonicalization html postprocessor #11224 ) can be tricky or at least requires conditionals.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions