Skip to content

Hide unparsable YAML front matter#413

Merged
schuyler merged 1 commit into
schuyler:mainfrom
yusufm:Codex/hide-invalid-yaml-frontmatter-019def52-b3da-7962-96cd-afa05d8d1592
Jun 22, 2026
Merged

Hide unparsable YAML front matter#413
schuyler merged 1 commit into
schuyler:mainfrom
yusufm:Codex/hide-invalid-yaml-frontmatter-019def52-b3da-7962-96cd-afa05d8d1592

Conversation

@yusufm

@yusufm yusufm commented May 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • advance the preview content offset after syntactic YAML front matter even when YAML parsing fails
  • keep front-matter title extraction from assuming the parsed object is always a dictionary
  • add regressions for invalid YAML and <title> values inside front matter

Related to #307.

Validation

  • xcodebuild test -workspace 'MacDown 3000.xcworkspace' -scheme MacDown -destination 'platform=macOS' -only-testing:MacDownTests/MPStringLookupTests/testFrontMatterContentOffsetWithInvalidYAML -only-testing:MacDownTests/MPRendererEdgeCaseTests/testRendererWithInvalidFrontMatterStillHidesFromPreview -only-testing:MacDownTests/MPRendererEdgeCaseTests/testRendererWithHTMLTitleInFrontMatterStillRendersBody

@yusufm yusufm marked this pull request as ready for review May 3, 2026 20:34

Copy link
Copy Markdown
Owner

Thanks, @yusufm! Reordering frontMatter: so the content offset is set before YAML parsing — and still skipping syntactic front matter when the YAML is invalid — is a nice hardening, and the respondsToSelector: guard in presumedFileName is a good touch. The new tests cover the cases well and CI is green. Appreciate the contribution! 🙏


Generated by Claude Code

@schuyler schuyler merged commit 243ad63 into schuyler:main Jun 22, 2026
5 checks passed
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.

2 participants