Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only parse frontmatter at top of file #12646

Merged
merged 3 commits into from
Dec 5, 2024
Merged

Only parse frontmatter at top of file #12646

merged 3 commits into from
Dec 5, 2024

Conversation

bluwy
Copy link
Member

@bluwy bluwy commented Dec 5, 2024

Changes

fix #12637

Updates the regex so it only does so.

We should also update the regex used for astro files frontmatter:

export const frontmatterRE = /^---(.*?)^---/ms;

But I prefer to follow up on that separately and fix the markdown case first.

Testing

Added new unit tests to ensure this behaviour.

Docs

n/a. bug fix.

Copy link

changeset-bot bot commented Dec 5, 2024

🦋 Changeset detected

Latest commit: be95adc

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the feat: markdown Related to Markdown (scope) label Dec 5, 2024
Copy link
Contributor

@ascorbic ascorbic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

til about the [\s\S] trick! Might be worth a comment explaining it.

@ascorbic
Copy link
Contributor

ascorbic commented Dec 5, 2024

Made me think of this
image

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@bluwy bluwy merged commit f13417b into main Dec 5, 2024
14 checks passed
@bluwy bluwy deleted the frontmatter-not-top branch December 5, 2024 14:50
@astrobot-houston astrobot-houston mentioned this pull request Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat: markdown Related to Markdown (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Markdown front matter within Markdown code blocks causes a crash
2 participants