-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
[MDX] Support YAML frontmatter #3995
Conversation
🦋 Changeset detectedLatest commit: 63e3074 The changes in this PR will be included in the next version bump. This PR includes changesets to release 13 packages
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 |
@@ -59,7 +59,7 @@ function shouldSkipDraft(pageModule: ComponentInstance, astroConfig: AstroConfig | |||
!astroConfig.markdown.drafts && | |||
// This is a draft post | |||
'frontmatter' in pageModule && | |||
(pageModule as any).frontmatter.draft === true | |||
(pageModule as any).frontmatter?.draft === true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remark-mdx-frontmatter applies export const frontmatter = undefined
when no frontmatter is present. This handles that case!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good! Is there any particular reason to expose the RemarkMdxFrontmatterOptions
to the user? If it's only to change frontmatter
, I feel like we probably don't need to expose it? I don't think we've ever gotten any requests to configure this setting for .md
files.
@natemoo-re Added some use cases to the README! I'd argue this is more necessary for MDX, since all |
Changes
remarkPlugins
config. This is different from GFM and smartypants, which are each removed when configuring withoutextends
. Let me know if this should be changed!frontmatter
object export by default. This should make theAstro.glob
experience fall in-line with plain markdown!frontmatterOptions
to config. This allows users to overrideremark-mdx-frontmatter
defaults (ex. use a name other than thefrontmatter
object as the destination for YAML, includingname: ''
to avoid ourfrontmatter
object).Testing
name
configDocs
variables
andfrontmatter
explainers to show both use casesfrontmatterOptions
to README