Skip to content

[BUG] Weird behavior with h2 headers when no h1 is present #2515

Closed
@nicfv

Description

@nicfv

Search terms

on, this, page, h1, h2, markdown, header, table, of, contents, readme

Expected Behavior

I do not have an h1 header in my README.md file, but several h2 headers. I expected them all to be in the same "level" in the Table Of Contents aka. On This Page. However, my first h2 header is at a higher level than the rest of them. See the screenshot below for what I mean.

Actual Behavior

In "On This Page", the first h2 header is shown as the main header with the rest of the h2 headers as subheaders below it.

Steps to reproduce the bug

  1. Create a typescript / typedoc project as normal
  2. Do not install any plugins or do anything special
  3. In the main readme file, remove the h1 # header
  4. Add multiple h2 ## headers (see my example code in extra)
  5. Build and serve the typedoc website

Environment

  • Typedoc version: 0.25.10
  • TypeScript version: 5.3.3
  • Node.js version: 20.11.1
  • OS: Ubuntu 22.04

Extra

td.png

Some text

## header one

Some more text

## header two

Some even more text

## header three

Goodbye

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions