quarto-dev / quarto-dev/quarto-cli

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

Open
#11,660 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

breadcrumbs enhancement
Dominant language
JavaScript
Stars
6k
Forks
458
Avg merge
1d 9h
Merged PRs (30d)
41

Description

This change was intended by

  • #11224

mainly as a fix for breadcrumbs when no title

  • #10567

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

Citing @cscheid from https://github.com/quarto-dev/quarto-cli/issues/11618#issuecomment-2523552404 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

  • #11618
  • #11596

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 #11224 ) can be tricky or at least requires conditionals.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read the discussion and prior work in #11224, #11618, #11596, and #11640, then inspect the Lua handling around Pandoc metadata and the different title-block partials. The behavior is complete when a top-level H1 supplies a missing title, while an H1 nested inside another element does not, without reproducing the reported regressions.

Written by the indexing model from the issue text.

Assessment

Tech stack
html, lua
Domain
content, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.