feat: basic support for mdx file extension (#964)

This commit is contained in:
Daniel Lautzenheiser 2023-10-31 11:31:04 -04:00 committed by GitHub
parent 597d135ff7
commit 215cb21e89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 76 additions and 1 deletions

View File

@ -17,3 +17,6 @@ quote_type = single
[*.md] [*.md]
trim_trailing_whitespace = false trim_trailing_whitespace = false
[*.mdx]
trim_trailing_whitespace = false

View File

@ -17,3 +17,6 @@ quote_type = single
[*.md] [*.md]
trim_trailing_whitespace = false trim_trailing_whitespace = false
[*.mdx]
trim_trailing_whitespace = false

View File

@ -0,0 +1,26 @@
---
main_menu:
- label: News
href: /news
- label: Features
href: '#features'
- label: About
href: '#about'
- label: Contact
href: '#contact'
footer_menus:
- label: Company
links:
- label: Home
href: /
- label: 'Privacy Policy '
href: '#'
- label: About us
href: '#'
- label: Documentation
links:
- label: Docs
href: '#'
- label: Blog
href: '#'
---

View File

@ -176,6 +176,45 @@ collections:
- label: Description - label: Description
name: description name: description
widget: text widget: text
- name: navigation
label: Navigation
file: packages/core/dev-test/backends/proxy/_data/navigation.mdx
extension: mdx
format: yaml-frontmatter
fields:
- name: main_menu
label: Main Menu
widget: list
collapsed: true
fields:
- name: label
label: Label
widget: string
- name: href
label: Href
widget: string
- name: footer_menus
label: Footer Menus
widget: list
collapsed: true
reuired: false
fields:
- name: label
label: Label
widget: string
- name: links
label: Links
widget: list
collapsed: true
fields:
- name: label
label: Label
widget: string
- name: href
label: Href
widget: string
- name: kitchenSink - name: kitchenSink
label: Kitchen Sink label: Kitchen Sink
folder: packages/core/dev-test/backends/proxy/_sink folder: packages/core/dev-test/backends/proxy/_sink

View File

@ -26,6 +26,7 @@ export const extensionFormatters: Record<string, FileFormatter> = {
toml: TomlFormatter, toml: TomlFormatter,
json: JsonFormatter, json: JsonFormatter,
md: FrontmatterInfer, md: FrontmatterInfer,
mdx: FrontmatterInfer,
markdown: FrontmatterInfer, markdown: FrontmatterInfer,
html: FrontmatterInfer, html: FrontmatterInfer,
}; };

View File

@ -17,3 +17,6 @@ quote_type = single
[*.md] [*.md]
trim_trailing_whitespace = false trim_trailing_whitespace = false
[*.mdx]
trim_trailing_whitespace = false

View File

@ -57,7 +57,7 @@ collections: [
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. 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.
`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`. `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`.
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. 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.