Skip to content

Commit 267671e

Browse files
committed
Add mdx support to isFormatMismatch logic
Fix #537
1 parent 8abd705 commit 267671e

2 files changed

Lines changed: 44 additions & 2 deletions

File tree

src/lib/services/config/parser/collections/format.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,12 @@ export const isFormatMismatch = (extension, format) => {
2020
// Normalize formats (yml and yaml are interchangeable)
2121
const normalizedFormat = format === 'yml' ? 'yaml' : format;
2222

23-
// For md/markdown extensions, only -frontmatter formats are valid
24-
if (normalizedExtension === 'md' || normalizedExtension === 'markdown') {
23+
// For md/markdown/mdx extensions, only -frontmatter formats are valid
24+
if (
25+
normalizedExtension === 'md' ||
26+
normalizedExtension === 'markdown' ||
27+
normalizedExtension === 'mdx'
28+
) {
2529
// Valid formats: 'frontmatter' (auto-detect) or any *-frontmatter format
2630
return !(normalizedFormat === 'frontmatter' || normalizedFormat.endsWith('-frontmatter'));
2731
}

src/lib/services/config/parser/collections/format.test.js

Lines changed: 38 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)