Skip to content

Conversation

@marcoroth
Copy link
Owner

This pull request adds support for preserving frontmatter when formatting HTML+ERB documents.

When the first Node within the DocumentNode is a HTMLTextNode and starts/ends with --- we treat that HTMLTextNode as frontmatter content and preserve/format it exactly as-is.

Example

The following document is now being preserved:

---
title: My Page
layout: application
published: true
---

<div class="container">
  <h1><%= @title %></h1>
</div>

Previously it was formatted as:

--- title: My Page layout: application published: true ---

<div class="container">
  <h1><%= @title %></h1>
</div>

Thanks to @joshuap for the nudge!

@marcoroth marcoroth merged commit d6c87e3 into main Nov 7, 2025
12 checks passed
@marcoroth marcoroth deleted the formatter-frontmatter branch November 7, 2025 05:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

2 participants