Custom delimiters (#1064)
* frontmatter functions now exported as curried constructors * changed formats.js to accomodate frontmatter.js changes * can only use custom delimiters if format is specified * reverting changes * updated tests to reflect changes * created tests for custom delimiters * updated docs to reflect addition of custom delimiter configuration * formatByExtension no longer takes custom delimiter * missed some formatByExtension calls * Edited the docs according to suggestions * Throws an error if a custom delimiter is set without declaring frontmatter format * Throws error if custom delimiter set without explicit and proper frontmatter format being declared * example config file set to proper defaults * moved frontmatterFormats to formats * Update .all-contributorsrc * updated contributions * Clarify docs
This commit is contained in:
@ -77,6 +77,7 @@ The `collections` setting is the heart of your Netlify CMS configuration, as it
|
||||
- `delete`: `false` prevents users from deleting items in a collection; defaults to `true`
|
||||
- `extension`: see detailed description below
|
||||
- `format`: see detailed description below
|
||||
- `frontmatter_delimiter`: see detailed description under `format`
|
||||
- `slug`: see detailed description below
|
||||
- `fields` (required): see detailed description below
|
||||
|
||||
@ -96,11 +97,11 @@ You may also specify a custom `extension` not included in the list above, as lon
|
||||
- `toml`: parses and saves files as TOML-formatted data files; saves with `toml` extension by default
|
||||
- `json`: parses and saves files as JSON-formatted data files; saves with `json` extension by default
|
||||
- `frontmatter`: parses files and saves files with data frontmatter followed by an unparsed body text (edited using a `body` field); saves with `md` extension by default; default for collections that can't be inferred. Collections with `frontmatter` format (either inferred or explicitly set) can parse files with frontmatter in YAML, TOML, or JSON format. However, they will be saved with YAML frontmatter.
|
||||
- `yaml-frontmatter`: same as the `frontmatter` format above, except frontmatter will be both parsed and saved only as YAML, followed by unparsed body text
|
||||
- `toml-frontmatter`: same as the `frontmatter` format above, except frontmatter will be both parsed and saved only as TOML, followed by unparsed body text
|
||||
- `json-frontmatter`: same as the `frontmatter` format above, except frontmatter will be both parsed and saved as JSON, followed by unparsed body text
|
||||
- `yaml-frontmatter`: same as the `frontmatter` format above, except frontmatter will be both parsed and saved only as YAML, followed by unparsed body text. The default delimiter for this option is `---`.
|
||||
- `toml-frontmatter`: same as the `frontmatter` format above, except frontmatter will be both parsed and saved only as TOML, followed by unparsed body text. The default delimiter for this option is `+++`.
|
||||
- `json-frontmatter`: same as the `frontmatter` format above, except frontmatter will be both parsed and saved as JSON, followed by unparsed body text. The default delimiter for this option is `{` `}`.
|
||||
|
||||
The explicit `yaml-frontmatter`, `toml-frontmatter`, and `json-frontmatter` formats above do not currently support custom delimiters. We use `---` for YAML, `+++` for TOML, and `{` `}` for JSON. If a file has frontmatter inside other delimiters it will be included as part of the body text.
|
||||
`frontmatter_delimiter`: if you have an explicit frontmatter format declared, this option allows you to specify a custom delimiter like `~~~`.
|
||||
|
||||
|
||||
### `slug`
|
||||
|
Reference in New Issue
Block a user