editor: fix frontmatter heading styling#426
Conversation
Frontmatter whose last line abuts the closing `---` (no blank line before the fence) gets tokenized as a setext heading by CodeMirror's markdown parser, so it rendered with large heading typography in edit mode. The metadata card owns frontmatter presentation, so neutralize heading tokens (color + font/weight/ line-height/spacing) inside `.cm-frontmatter-line`. Also adds a preview regression test that leading YAML/TOML frontmatter stays hidden. Verified in the app: the setext-tokenized frontmatter line renders at normal card size while a real body heading stays large. Thanks to @junereycasuga for the fix.
|
Thanks @junereycasuga — this is exactly right, and yes, it's the intended UI: leading frontmatter is meant to render as a compact metadata card, never as body-heading typography. Nice diagnosis on the setext-heading tokenization (a frontmatter line abutting the closing Merged into the v2.15.0 release branch in 9ab0424 (this repo lands fixes on a per-release branch that fast-forwards into |
|
Small correction: I couldn't retarget the base — GitHub reports "no new commits between v2.15.0 and fix/frontmatter-render" because your commit is already contained in the release branch (I brought it in via a merge, 9ab0424, so your authorship is preserved). I'll leave this PR open against |
Fix frontmatter styling in the editor.
CodeMirror can tokenize the line before a closing
---frontmatter fence as a setext heading when there isn't a blank line before the fence. This caused valid frontmatter to render with large heading typography in edit mode.This makes frontmatter card styling override heading tokens inside the frontmatter block, so both forms render consistently.
Also adds a preview regression test that verifies leading YAML/TOML frontmatter is hidden from rendered markdown.
Before:

After:
