Skip to content

Fix frontmatter property spaces#96

Merged
jsgrrchg merged 1 commit into
mainfrom
fix-frontmatter-spaces-preview
May 17, 2026
Merged

Fix frontmatter property spaces#96
jsgrrchg merged 1 commit into
mainfrom
fix-frontmatter-spaces-preview

Conversation

@jsgrrchg
Copy link
Copy Markdown
Owner

Summary

Fixes #43.

This fixes text editing in the live preview Properties/frontmatter panel so trailing spaces are not immediately stripped while the user is typing. The root cause was that serializeFrontmatterRaw trimmed string values on every keystroke; because the panel is controlled by the serialized frontmatter, typing a space at the end of a property value was instantly normalized away.

The serializer now preserves string values during editing, still drops values that are empty after trimming, and quotes YAML values when leading or trailing whitespace must be preserved.

Validation

  • npm test -- --run src/features/editor/FrontmatterPanel.helpers.test.ts src/features/editor/Editor.test.tsx --testNamePattern "allows inserting spaces|properties|Frontmatter helpers"
  • npm run lint -- src/features/editor/FrontmatterPanel.tsx src/features/editor/FrontmatterPanel.helpers.test.ts src/features/editor/Editor.test.tsx

@jsgrrchg jsgrrchg marked this pull request as ready for review May 17, 2026 07:57
@jsgrrchg jsgrrchg merged commit 41916d1 into main May 17, 2026
3 checks passed
@jsgrrchg jsgrrchg deleted the fix-frontmatter-spaces-preview branch May 17, 2026 08:03
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.

Live preview fronttmatter doesn't allow inserting spaces.

1 participant