Skip to content

Last item in frontmatter shows up in the outline as H2, unless a blank line is added #442

Closed

Description

@stevecopley

Issue

The last item in the frontmatter of a note is being parsed as an H2 for the outline view, due to the closing frontmatter marker --- being read as the alternative heading markup for an H2 heading:

This is an H2 Heading
---

Example

So, for this example...

---
title: Test
type: Test
---

... the outline shows H2: type: Test

Adding a blank line at the end of the frontmatter block fixes the mis-parsing...

---
title: Test
type: Test

---

To Solve

The outline parser should skip the whole of the frontmatter block

Activity

  1. naingyeminn commented on Jul 22, 2026

    @naingyeminn

    I think it had been fixed in v2.15.0.

  2. stevecopley commented on Jul 22, 2026

    @stevecopley
    Author

    It was 2.15 that I was using... I know the release notes mentioned fixing an issue to do with the front matter itself being rendered incorrectly, but the issue I mention here is to do with the outline panel display... The front matter looks fine, but the outline shows a phantom H2 heading.

  3. adibhanna commented on Jul 22, 2026

    @adibhanna
    Contributor

    Fixed in c254162 (on the v2.16.0 branch), shipping in the next release.

    You were right that this is distinct from the v2.15.0 frontmatter fix (#426): that one stopped the last frontmatter line from rendering as a big heading in the editor, whereas this is the outline parser. Same root cause, though. A note's closing frontmatter --- was being read as a Setext-style H2 underline for the line above it, so with no blank line before the fence:

    ---
    title: Test
    type: Test
    ---

    type: Test surfaced as a phantom H2 in the outline.

    The outline parser now skips the whole leading frontmatter block before it looks for headings (matching the editor's own frontmatter detection). Since that same parser also backs the outline palette, [[#heading]] link resolution, and wikilink navigation, those stop matching the phantom heading too.

    Verified with new unit tests covering your exact example, and by driving the built desktop app over CDP: a note with title: / type: frontmatter plus two real headings now shows exactly two outline entries, no phantom.

    Thanks for the clear report and the precise repro.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions