docs(fix): revert prettier formatting on markdown files (#1612)

Prettier formatting our markdown files is causing bugs because of the
differences between Gatsby's parser and Prettier's. Also, Prettier
formats the inline code-blocks containing example CMS configs, but the
formatting it uses doesn't really make much sense or match the suggested
CMS config style.

It doesn't actually make much sense to format the docs anyway, since we
use the CMS itself to edit/generate them.
This commit is contained in:
Caleb
2018-08-14 11:33:13 -06:00
committed by GitHub
parent dd56d6e2d9
commit ebc2471c6b
40 changed files with 452 additions and 502 deletions

View File

@ -1,5 +1,5 @@
---
label: 'Boolean'
label: "Boolean"
target: boolean
---
@ -12,5 +12,5 @@ The boolean widget translates a toggle switch input to a true/false value.
- `default`: accepts `true` or `false`; defaults to `false`
- **Example:**
```yaml
- { label: 'Draft', name: 'draft', widget: 'boolean', default: true }
- {label: "Draft", name: "draft", widget: "boolean", default: true}
```

View File

@ -1,5 +1,5 @@
---
label: 'Date'
label: "Date"
target: date
---
@ -13,9 +13,9 @@ The date widget translates a date picker input to a date string. For saving date
- `format`: optional; accepts Moment.js [tokens](https://momentjs.com/docs/#/parsing/string-format/); defaults to raw Date object (if supported by output format)
- **Example:**
```yaml
- label: 'Birthdate'
name: 'birthdate'
widget: 'date'
default: ''
format: 'MMM Do YY'
- label: "Birthdate"
name: "birthdate"
widget: "date"
default: ""
format: "MMM Do YY"
```

View File

@ -1,5 +1,5 @@
---
label: 'DateTime'
label: "DateTime"
target: datetime
---
@ -13,9 +13,9 @@ The datetime widget translates a datetime picker to a datetime string. For savin
- `format`: optional; accepts Moment.js [tokens](https://momentjs.com/docs/#/parsing/string-format/); defaults to raw Date object (if supported by output format)
- **Example:**
```yaml
- label: 'Start time'
name: 'start'
widget: 'datetime'
default: ''
format: 'LLL'
- label: "Start time"
name: "start"
widget: "datetime"
default: ""
format: "LLL"
```

View File

@ -1,5 +1,5 @@
---
label: 'File'
label: "File"
target: file
---
@ -12,8 +12,8 @@ The file widget allows editors to upload a file or select an existing one from t
- `default`: accepts a file path string; defaults to null
- **Example:**
```yaml
- label: 'Manual PDF'
name: 'manual_pdf'
widget: 'file'
default: '/uploads/general-manual.pdf'
- label: "Manual PDF"
name: "manual_pdf"
widget: "file"
default: "/uploads/general-manual.pdf"
```

View File

@ -1,5 +1,5 @@
---
label: 'Hidden'
label: "Hidden"
target: hidden
---
@ -8,9 +8,9 @@ Hidden widgets do not display in the UI. In folder collections that allow users
- **Name:** `hidden`
- **UI:** none
- **Data type:** any valid data type
- **Options:**
- **Options:**
- `default`: accepts any valid data type; recommended for collections that allow adding new items
- **Example:**
```yaml
- { label: 'Layout', name: 'layout', widget: 'hidden', default: 'blog' }
- {label: "Layout", name: "layout", widget: "hidden", default: "blog"}
```

View File

@ -1,5 +1,5 @@
---
label: 'Image'
label: "Image"
target: image
---
@ -12,8 +12,8 @@ The image widget allows editors to upload an image or select an existing one fro
- `default`: accepts a file path string; defaults to null
- **Example:**
```yaml
- label: 'Featured Image'
name: 'thumbnail'
widget: 'image'
default: '/uploads/chocolate-dogecoin.jpg'
- label: "Featured Image"
name: "thumbnail"
widget: "image"
default: "/uploads/chocolate-dogecoin.jpg"
```

View File

@ -10,19 +10,19 @@ Widgets are specified as collection fields in the Netlify CMS `config.yml` file.
To see working examples of all of the built-in widgets, try making a 'Kitchen Sink' collection item on the [CMS demo site](https://cms-demo.netlify.com). (No login required: click the login button and the CMS will open.) You can refer to the demo [configuration code](https://github.com/netlify/netlify-cms/blob/master/packages/netlify-cms/example/config.yml) to see how each field was configured.
## Common widget options
The following options are available on all fields:
- `required`: specify as `false` to make a field optional; defaults to `true`
- `pattern`: add field validation by specifying a list with a [regex pattern](https://regexr.com/) and an error message; more extensive validation can be achieved with [custom widgets](https://www.netlifycms.org/docs/custom-widgets/#advanced-field-validation)
- **Example:**
```yaml
- label: 'Title'
name: 'title'
widget: 'string'
pattern: ['.{12,}', 'Must have at least 12 characters']
- label: "Title"
name: "title"
widget: "string"
pattern: [".{12,}", "Must have at least 12 characters"]
```
## Default widgets

View File

@ -1,5 +1,5 @@
---
label: 'List'
label: "List"
target: list
---
@ -15,38 +15,38 @@ The list widget allows you to create a repeatable item in the UI which saves as
- `fields`: a nested list of multiple widget fields to be included in each repeatable iteration
- **Example** (`field`/`fields` not specified):
```yaml
- label: 'Tags'
name: 'tags'
widget: 'list'
default: ['news']
- label: "Tags"
name: "tags"
widget: "list"
default: ["news"]
```
- **Example** (`allow_add` marked `false`):
```yaml
- label: 'Tags'
name: 'tags'
widget: 'list'
- label: "Tags"
name: "tags"
widget: "list"
allow_add: false
default: ['news']
default: ["news"]
```
- **Example** (with `field`):
```yaml
- label: 'Gallery'
name: 'galleryImages'
widget: 'list'
- label: "Gallery"
name: "galleryImages"
widget: "list"
field:
- { label: Image, name: image, widget: image }
- {label: Image, name: image, widget: image}
```
- **Example** (with `fields`):
```yaml
- label: 'Testimonials'
name: 'testimonials'
widget: 'list'
- label: "Testimonials"
name: "testimonials"
widget: "list"
fields:
- { label: Quote, name: quote, widget: string, default: 'Everything is awesome!' }
- {label: Quote, name: quote, widget: string, default: "Everything is awesome!"}
- label: Author
name: author
widget: object
fields:
- { label: Name, name: name, widget: string, default: 'Emmet' }
- { label: Avatar, name: avatar, widget: image, default: '/img/emmet.jpg' }
- {label: Name, name: name, widget: string, default: "Emmet"}
- {label: Avatar, name: avatar, widget: image, default: "/img/emmet.jpg"}
```

View File

@ -1,11 +1,11 @@
---
label: 'Markdown'
label: "Markdown"
target: markdown
---
The markdown widget provides a full fledged text editor - which is based on [slate](https://github.com/ianstormtaylor/slate) - that allows users to format text with features such as headings and blockquotes. Users are also allowed to write in markdown by simply flipping a switch.
_Please note:_ in case you want to use your markdown editor to fill a markdown's file content after the frontmatter, you'll have name the field as `body` so then the CMS can recognize it and save the file accordingly.
*Please note:* in case you want to use your markdown editor to fill a markdown's file content after the frontmatter, you'll have name the field as `body` so then the CMS can recognize it and save the file accordingly.
- **Name:** `markdown`
- **UI:** full text editor
@ -15,7 +15,7 @@ _Please note:_ in case you want to use your markdown editor to fill a markdown's
- `buttons`: an array of strings representing the formatting buttons to display, all buttons shown by default. Buttons include: `bold`, `italic`, `code`, `link`, `heading-one`, `heading-two`, `quote`, `code-block`, `bulleted-list`, and `numbered-list`.
- **Example:**
```yaml
- { label: 'Blog post content', name: 'body', widget: 'markdown' }
- {label: "Blog post content", name: "body", widget: "markdown"}
```
This would render as:
![Markdown widget example](/img/widgets-markdown.png)

View File

@ -1,5 +1,5 @@
---
label: 'Number'
label: "Number"
target: number
---
@ -15,11 +15,11 @@ The number widget uses an HTML number input, saving the value as a string, integ
- `max`: accepts a number for maximum value accepted; unset by default
- **Example:**
```yaml
- label: 'Puppy Count'
name: 'puppies'
widget: 'number'
- label: "Puppy Count"
name: "puppies"
widget: "number"
default: 2
valueType: 'int'
valueType: "int"
min: 1
max: 101
```

View File

@ -1,5 +1,5 @@
---
label: 'Object'
label: "Object"
target: object
---
@ -13,22 +13,22 @@ The object widget allows you to group multiple widgets together, nested under a
- `fields`: (**required**) a nested list of widget fields to include in your widget
- **Example:**
```yaml
- label: 'Profile'
name: 'profile'
widget: 'object'
- label: "Profile"
name: "profile"
widget: "object"
fields:
- { label: 'Public', name: 'public', widget: 'boolean', default: true }
- { label: 'Name', name: 'name', widget: 'string' }
- label: 'Birthdate'
name: 'birthdate'
widget: 'date'
default: ''
format: 'MM/DD/YYYY'
- label: 'Address'
name: 'address'
widget: 'object'
fields:
- { label: 'Street Address', name: 'street', widget: 'string' }
- { label: 'City', name: 'city', widget: 'string' }
- { label: 'Postal Code', name: 'post-code', widget: 'string' }
- {label: "Public", name: "public", widget: "boolean", default: true}
- {label: "Name", name: "name", widget: "string"}
- label: "Birthdate"
name: "birthdate"
widget: "date"
default: ""
format: "MM/DD/YYYY"
- label: "Address"
name: "address"
widget: "object"
fields:
- {label: "Street Address", name: "street", widget: "string"}
- {label: "City", name: "city", widget: "string"}
- {label: "Postal Code", name: "post-code", widget: "string"}
```

View File

@ -1,5 +1,5 @@
---
label: 'Relation'
label: "Relation"
target: relation
---
@ -16,12 +16,12 @@ The relation widget allows you to reference items from another collection. It pr
- `valueField`: (**required**) name of the field from the referenced collection whose value will be stored for the relation
- **Example** (assuming a separate "authors" collection with "name" and "twitterHandle" fields):
```yaml
- label: 'Post Author'
name: 'author'
widget: 'relation'
collection: 'authors'
searchFields: ['name', 'twitterHandle']
valueField: 'name'
displayFields: ['twitterHandle', 'followerCount']
- label: "Post Author"
name: "author"
widget: "relation"
collection: "authors"
searchFields: ["name", "twitterHandle"]
valueField: "name"
displayFields: ["twitterHandle", "followerCount"]
```
The generated UI input will search the authors collection by name and twitterHandle, and display each author's handle and follower count. On selection, the author name will be saved for the field.

View File

@ -1,5 +1,5 @@
---
label: 'Select'
label: "Select"
target: select
---
@ -11,22 +11,23 @@ The select widget allows you to pick a single string value from a dropdown menu.
- **Options:**
- `default`: accepts a string; defaults to an empty string
- `options`: (**required**) a list of options for the dropdown menu; can be listed in two ways:
- string values: the label displayed in the dropdown is the value saved in the file
- object with `label` and `value` fields: the label displays in the dropdown; the value is saved in the file
- string values: the label displayed in the dropdown is the value saved in the file
- object with `label` and `value` fields: the label displays in the dropdown; the value is saved in the file
- **Example** (options as strings):
```yaml
- label: 'Align Content'
name: 'align'
widget: 'select'
options: ['left', 'center', 'right']
- label: "Align Content"
name: "align"
widget: "select"
options: ["left", "center", "right"]
```
- **Example** (options as objects):
```yaml
- label: 'City'
name: 'airport-code'
widget: 'select'
- label: "City"
name: "airport-code"
widget: "select"
options:
- { label: 'Chicago', value: 'ORD' }
- { label: 'Paris', value: 'CDG' }
- { label: 'Tokyo', value: 'HND' }
- { label: "Chicago", value: "ORD" }
- { label: "Paris", value: "CDG" }
- { label: "Tokyo", value: "HND" }
```

View File

@ -1,5 +1,5 @@
---
label: 'String'
label: "String"
target: string
---
@ -12,5 +12,5 @@ The string widget translates a basic text input to a string value. For larger te
- `default`: accepts a string; defaults to an empty string
- **Example:**
```yaml
- { label: 'Title', name: 'title', widget: 'string' }
- {label: "Title", name: "title", widget: "string"}
```

View File

@ -1,5 +1,5 @@
---
label: 'Text'
label: "Text"
target: text
---
@ -12,5 +12,5 @@ The text widget takes a multiline text field and saves it as a string. For short
- `default`: accepts a string; defaults to an empty string
- **Example:**
```yaml
- { label: 'Description', name: 'description', widget: 'text' }
- {label: "Description", name: "description", widget: "text"}
```