Skip to content
This repository was archived by the owner on Sep 9, 2024. It is now read-only.

Commit 215cb21

Browse files
authored
feat: basic support for mdx file extension (#964)
1 parent 597d135 commit 215cb21

File tree

7 files changed

+76
-1
lines changed

7 files changed

+76
-1
lines changed

packages/app/.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,6 @@ quote_type = single
1717

1818
[*.md]
1919
trim_trailing_whitespace = false
20+
21+
[*.mdx]
22+
trim_trailing_whitespace = false

packages/core/.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,6 @@ quote_type = single
1717

1818
[*.md]
1919
trim_trailing_whitespace = false
20+
21+
[*.mdx]
22+
trim_trailing_whitespace = false
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
main_menu:
3+
- label: News
4+
href: /news
5+
- label: Features
6+
href: '#features'
7+
- label: About
8+
href: '#about'
9+
- label: Contact
10+
href: '#contact'
11+
footer_menus:
12+
- label: Company
13+
links:
14+
- label: Home
15+
href: /
16+
- label: 'Privacy Policy '
17+
href: '#'
18+
- label: About us
19+
href: '#'
20+
- label: Documentation
21+
links:
22+
- label: Docs
23+
href: '#'
24+
- label: Blog
25+
href: '#'
26+
---

packages/core/dev-test/backends/proxy/config.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,45 @@ collections:
176176
- label: Description
177177
name: description
178178
widget: text
179+
180+
- name: navigation
181+
label: Navigation
182+
file: packages/core/dev-test/backends/proxy/_data/navigation.mdx
183+
extension: mdx
184+
format: yaml-frontmatter
185+
fields:
186+
- name: main_menu
187+
label: Main Menu
188+
widget: list
189+
collapsed: true
190+
fields:
191+
- name: label
192+
label: Label
193+
widget: string
194+
- name: href
195+
label: Href
196+
widget: string
197+
- name: footer_menus
198+
label: Footer Menus
199+
widget: list
200+
collapsed: true
201+
reuired: false
202+
fields:
203+
- name: label
204+
label: Label
205+
widget: string
206+
- name: links
207+
label: Links
208+
widget: list
209+
collapsed: true
210+
fields:
211+
- name: label
212+
label: Label
213+
widget: string
214+
- name: href
215+
label: Href
216+
widget: string
217+
179218
- name: kitchenSink
180219
label: Kitchen Sink
181220
folder: packages/core/dev-test/backends/proxy/_sink

packages/core/src/formats/formats.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export const extensionFormatters: Record<string, FileFormatter> = {
2626
toml: TomlFormatter,
2727
json: JsonFormatter,
2828
md: FrontmatterInfer,
29+
mdx: FrontmatterInfer,
2930
markdown: FrontmatterInfer,
3031
html: FrontmatterInfer,
3132
};

packages/docs/.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,6 @@ quote_type = single
1717

1818
[*.md]
1919
trim_trailing_whitespace = false
20+
21+
[*.mdx]
22+
trim_trailing_whitespace = false

packages/docs/content/docs/collection-overview.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ collections: [
5757

5858
These settings determine how collection files are parsed and saved. Both are optional—Static CMS will attempt to infer your settings based on existing items in the collection. If your collection is empty, or you'd like more control, you can set these fields explicitly.
5959

60-
`extension` determines the file extension searched for when finding existing entries in a folder collection and it determines the file extension used to save new collection items. It accepts the following values: `yml`, `yaml`, `json`, `md`, `markdown`, `html`.
60+
`extension` determines the file extension searched for when finding existing entries in a folder collection and it determines the file extension used to save new collection items. It accepts the following values: `yml`, `yaml`, `json`, `md`, `markdown`, `mdx`, `html`.
6161

6262
You may also specify a custom `extension` not included in the list above, as long as the collection files can be parsed and saved in one of the supported formats below.
6363

0 commit comments

Comments
 (0)