Skip to content

Conversation

@Tristan-Wilson
Copy link

Frontmatter is metadata at the start of markdown files, delimited by --- (YAML) or +++ (TOML). It's commonly used by static site generators (Jekyll, Hugo, etc.) for page metadata like title, date, and author. Previously, this extension always stripped frontmatter from the rendered output while extracting the title for the page.

This change adds a "frontmatter" toggle in the Content settings that allows users to optionally display the frontmatter block.

When displayed, frontmatter is wrapped in a <div class="frontmatter"> containing a fenced code block (yaml or toml). This approach:

  • Preserves Prism syntax highlighting for the frontmatter content
  • Allows targeting .frontmatter pre code with CSS for word wrapping, so long lines wrap instead of causing horizontal scroll
  • Keeps other code blocks unaffected (no wrapping)

Title extraction from frontmatter still occurs regardless of whether the frontmatter is displayed.

Testing

frontmatter is disabled by default

Screenshot from 2025-11-26 16-17-42

Enabling frontmatter shows the frontmatter in a formatted code block

Screenshot from 2025-11-26 16-17-48

Continues to display after menu is exited

Screenshot from 2025-11-26 16-17-53

Frontmatter is metadata at the start of markdown files, delimited by
`---` (YAML) or `+++` (TOML). It's commonly used by static site
generators (Jekyll, Hugo, etc.) for page metadata like title, date,
and author. Previously, this extension always stripped frontmatter
from the rendered output while extracting the title for the page.

This change adds a "frontmatter" toggle in the Content settings that
allows users to optionally display the frontmatter block.

When displayed, frontmatter is wrapped in a `<div class="frontmatter">`
containing a fenced code block (```yaml or ```toml). This approach:
- Preserves Prism syntax highlighting for the frontmatter content
- Allows targeting `.frontmatter pre code` with CSS for word wrapping,
  so long lines wrap instead of causing horizontal scroll
- Keeps other code blocks unaffected (no wrapping)

Title extraction from frontmatter still occurs regardless of whether
the frontmatter is displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant