feat(test): add docs linter to PR workflow actions (#4321)

This commit is contained in:
silverwebb925
2020-10-11 07:02:47 -07:00
committed by GitHub
parent 277a1519be
commit 2146b3605f
37 changed files with 23405 additions and 286 deletions

View File

@ -1,27 +1,28 @@
---
label: "Image"
title: image
label: Image
---
The image widget allows editors to upload an image or select an existing one from the media library. The path to the image file will be saved to the field as a string.
- **Name:** `image`
- **UI:** file picker button opens media gallery allowing image files (jpg, jpeg, webp, gif, png, bmp, tiff, svg) only; displays selected image thumbnail
- **Data type:** file path string
- **Options:**
- `default`: accepts a file path string; defaults to null
- `media_library`: media library settings to apply when a media library is opened by the
* **Name:** `image`
* **UI:** file picker button opens media gallery allowing image files (jpg, jpeg, webp, gif, png, bmp, tiff, svg) only; displays selected image thumbnail
* **Data type:** file path string
* **Options:**
* `default`: accepts a file path string; defaults to null
* `media_library`: settings to apply when opening a media library is opened by the
current widget
- `allow_multiple`: _(default: `true`)_ when set to `false`, prevents multiple selection for any media library extension, but must be supported by the extension in use
- `config`: a configuration object that will be passed directly to the media library being
used - available options are determined by the library
- **Example:**
```yaml
- label: "Featured Image"
name: "thumbnail"
widget: "image"
default: "/uploads/chocolate-dogecoin.jpg"
media_library:
config:
multiple: true
```
* `allow_multiple`: *(default: `true`)* when set to `false`, if the media library extension supports it, multiple selection will be disabled
* `config`: a configuration object passed directly to the media library; check the documentation of your media library extension for available `config` options.
* **Example:**
```yaml
- label: "Featured Image"
name: "thumbnail"
widget: "image"
default: "/uploads/chocolate-dogecoin.jpg"
media_library:
config:
multiple: true
```

View File

@ -1,77 +1,83 @@
---
label: "List"
title: list
label: List
---
The list widget allows you to create a repeatable item in the UI which saves as a list of widget values. map a user-provided string with a comma delimiter into a list. You can choose any widget as a child of a list widget—even other lists.
- **Name:** `list`
- **UI:** if `fields` is specified, field containing a repeatable child widget, with controls for adding, deleting, and re-ordering the repeated widgets; if unspecified, a text input for entering comma-separated values
- **Data type:** list of widget values
- **Options:**
- `default`: if `fields` is specified, declare defaults on the child widgets; if not, you may specify a list of strings to populate the text field
- `allow_add`: if added and set to `false`, hides the button to add additional items
- `collapsed`: if added and set to `false`, the list widget's content does not collapse by default
- `summary`: allows customization of a collapsed list item object in a similar way to a [collection summary](/docs/configuration-options/?#summary)
- `minimize_collapsed`: if added and set to `true`, the list widget's content will be completely hidden instead of only collapsed if the list widget itself is collapsed
- `label_singular`: singular label to show as a part of the add button
- `field`: a single widget field to be repeated
- `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"]
```
- **Example** (`allow_add` marked `false`):
```yaml
- label: "Tags"
name: "tags"
widget: "list"
allow_add: false
default: ["news"]
```
- **Example** (with `field`):
```yaml
- label: "Gallery"
name: "galleryImages"
widget: "list"
summary: '{{fields.image}}'
field: {label: Image, name: image, widget: image}
```
- **Example** (with `fields`):
```yaml
- label: "Testimonials"
name: "testimonials"
widget: "list"
summary: '{{fields.quote}} - {{fields.author.name}}'
fields:
- {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"}
```
- **Example** (`collapsed` marked `false`):
```yaml
- label: "Testimonials"
name: "testimonials"
collapsed: false
widget: "list"
fields:
- {label: Quote, name: quote, widget: string, default: "Everything is awesome!"}
- {label: Author, name: author, widget: string }
```
- **Example** (`minimize_collapsed` marked `true`):
```yaml
- label: "Testimonials"
name: "testimonials"
minimize_collapsed: true
widget: "list"
fields:
- {label: Quote, name: quote, widget: string, default: "Everything is awesome!"}
- {label: Author, name: author, widget: string }
```
* **Name:** `list`
* **UI:** without any `fields` specified, the list widget defaults to a text input for entering comma-separated values; with `fields` specified, the list widget contains a repeatable child widget, with controls for adding, deleting, and re-ordering the repeated widgets.
* **Data type:** list of widget values
* **Options:**
* `default`: you may specify a list of strings to populate the basic text field, but declare defaults on the child widgets if you are specifying `fields`;
* `allow_add`: `false` hides the button to add additional items
* `collapsed`: when `true`, the entries collapse by default
* `summary`: specify the label displayed on collapsed entries
* `minimize_collapsed`: when `true`, collapsing the list widget will hide all of it's entries instead of showing summaries
* `label_singular`: the text to show on the add button
* `field`: a single widget field to be repeated
* `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"]
```
* **Example** (`allow_add` marked `false`):
```yaml
- label: "Tags"
name: "tags"
widget: "list"
allow_add: false
default: ["news"]
```
* **Example** (with `field`):
```yaml
- label: "Gallery"
name: "galleryImages"
widget: "list"
summary: '{{fields.image}}'
field: {label: Image, name: image, widget: image}
```
* **Example** (with `fields`):
```yaml
- label: "Testimonials"
name: "testimonials"
widget: "list"
summary: '{{fields.quote}} - {{fields.author.name}}'
fields:
- {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"}
```
* **Example** (`collapsed` marked `false`):
```yaml
- label: "Testimonials"
name: "testimonials"
collapsed: false
widget: "list"
fields:
- {label: Quote, name: quote, widget: string, default: "Everything is awesome!"}
- {label: Author, name: author, widget: string }
```
* **Example** (`minimize_collapsed` marked `true`):
```yaml
- label: "Testimonials"
name: "testimonials"
minimize_collapsed: true
widget: "list"
fields:
- {label: Quote, name: quote, widget: string, default: "Everything is awesome!"}
- {label: Author, name: author, widget: string }
```

View File

@ -1,18 +1,19 @@
---
title: map
label: "Map"
label: Map
---
The map widget allows you to edit spatial data using an interactive map. Spatial data for a single piece of geometry saves as a GeoJSON string in WGS84 projection.
The map widget allows you to edit spatial data using an interactive map. Spatial data is saved as a GeoJSON string in WGS84 projection and is limited to a single geometry.
* **Name:** `map`
* **UI:** interactive map
* **Data type:** GeoJSON string
* **Options:**
- **Name:** `map`
- **UI:** interactive map
- **Data type:** GeoJSON string
- **Options:**
- `decimals`: accepts a number to specify precision of saved coordinates; defaults to 7 decimals
- `default`: accepts a GeoJSON string containing a single geometry; defaults to an empty string
- `type`: accepts one string value of `Point`, `LineString` or `Polygon`; defaults to `Point`
- **Example:**
```yaml
- {label: "Location", name: "location", widget: "map" }
```
* `decimals`: accepts a number to specify precision of saved coordinates; defaults to 7 decimals
* `default`: accepts a GeoJSON string containing a single geometry; defaults to an empty string
* `type`: accepts one string value of `Point`, `LineString` or `Polygon`; defaults to `Point`
* **Example:**
```yaml
- {label: "Location", name: "location", widget: "map" }
```

View File

@ -1,22 +1,22 @@
---
label: 'Markdown'
title: markdown
label: Markdown
---
The markdown widget provides a full fledged text editor allowing users to format text with features such as headings and blockquotes. Users can change their editing view with a handy toggle button.
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:* If you want to use your markdown editor to fill a markdown file contents after its frontmatter, you'll have to name the field `body` so the CMS recognizes it and saves the file accordingly.
_Please note:_ If you want to use your markdown editor to fill a markdown file contents after its frontmatter, you'll have to name the field `body` so the CMS recognizes it and saves the file accordingly.
* **Name:** `markdown`
* **UI:** full text editor
* **Data type:** markdown
* **Options:**
- **Name:** `markdown`
- **UI:** full text editor
- **Data type:** markdown
- **Options:**
- `default`: accepts markdown content
- `minimal`: accepts a boolean value, `false` by default. Sets the widget height to minimum possible.
- `buttons`: an array of strings representing the formatting buttons to display (all shown by default). Buttons include: `bold`, `italic`, `code`, `link`, `heading-one`, `heading-two`, `heading-three`, `heading-four`, `heading-five`, `heading-six`, `quote`, `bulleted-list`, and `numbered-list`.
- `editor_components`: an array of strings representing the names of editor components to display (all shown by default). The `image` and `code-block` editor components are included with Netlify CMS by default, but others may be [created and registered](/docs/custom-widgets/#registereditorcomponent).
- `modes`: an array of strings representing the names of allowed editor modes. Possible modes are `raw` and `rich_text`. If both modes are allowed, they can be toggled via a toggle button in the toolbar.
- **Example:**
* `default`: accepts markdown content
* `minimal`: accepts a boolean value, `false` by default. Sets the widget height to minimum possible.
* `buttons`: an array of strings representing the formatting buttons to display (all shown by default). Buttons include: `bold`, `italic`, `code`, `link`, `heading-one`, `heading-two`, `heading-three`, `heading-four`, `heading-five`, `heading-six`, `quote`, `bulleted-list`, and `numbered-list`.
* `editor_components`: an array of strings representing the names of editor components to display (all shown by default). Netlify CMS includes `image` and `code-block` editor components by default, and custom components may be [created and registered](/docs/custom-widgets/#registereditorcomponent).
* `modes`: an array of strings representing the names of allowed editor modes. Possible modes are `raw` and `rich_text`. A toggle button appears in the toolbar when more than one mode is available.
* **Example:**
```yaml
- { label: 'Blog post content', name: 'body', widget: 'markdown' }
@ -26,4 +26,4 @@ This would render as:
![Markdown widget example](/img/widgets-markdown.png)
_Please note:_ The markdown widget outputs a raw markdown string. Your static site generator may or may not render the markdown to HTML automatically. Consult with your static site generator's documentation for more information about rendering markdown.
*Please note:* The markdown widget outputs a raw markdown string. Your static site generator may or may not render the markdown to HTML automatically. Consult with your static site generator's documentation for more information about rendering markdown.

View File

@ -1,36 +1,37 @@
---
label: "Object"
title: object
label: Object
---
The object widget allows you to group multiple widgets together, nested under a single field. You can choose any widget as a child of an object widget—even other objects.
- **Name:** `object`
- **UI:** a field containing one or more child widgets
- **Data type:** list of child widget values
- **Options:**
- `default`: you can set defaults within each sub-field's configuration
- `collapsed`: if added and labeled `true`, the widget's content is collapsed by default
- `fields`: (**required**) a nested list of widget fields to include in your widget
- **Example:**
```yaml
- 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"
collapsed: true
fields:
- {label: "Street Address", name: "street", widget: "string"}
- {label: "City", name: "city", widget: "string"}
- {label: "Postal Code", name: "post-code", widget: "string"}
```
* **Name:** `object`
* **UI:** a field containing one or more child widgets
* **Data type:** list of child widget values
* **Options:**
* `default`: you can set defaults within each sub-field's configuration
* `collapsed`: if added and labeled `true`, collapse the widget's content by default
* `fields`: (**required**) a nested list of widget fields to include in your widget
* **Example:**
```yaml
- 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"
collapsed: true
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,23 +1,23 @@
---
label: "Relation"
title: relation
label: Relation
---
The relation widget allows you to reference items from another collection. It provides a search input with a list of entries from the collection you're referencing, and the list automatically updates with matched entries based on what you've typed.
- **Name:** `relation`
- **UI:** text input with search result dropdown
- **Data type:** data type of the value pulled from the related collection item
- **Options:**
- `collection`: (**required**) name of the collection being referenced (string)
- `value_field`: (**required**) name of the field from the referenced collection whose value will be stored for the relation. For nested fields, separate each subfield with a `.` (e.g. `name.first`). For list fields use a wildcard `*` to target all list items (e.g. `categories.*`).
- `search_fields`: (**required**) list of one or more names of fields in the referenced collection to search for the typed value. Syntax to reference nested fields is similar to that of *value_field*.
- `file`: allows referencing a specific file when the collection being referenced is a files collection (string)
- `display_fields`: list of one or more names of fields in the referenced collection that will render in the autocomplete menu of the control. Defaults to `value_field`. Syntax to reference nested fields is similar to that of *value_field*.
- `default`: accepts any widget data type; defaults to an empty string
- `multiple` : accepts a boolean, defaults to `false`
- `options_length`: accepts integer to override number of options presented to user. Defaults to `20`.
- **Referencing a folder collection example** (assuming a separate "authors" collection with "name" and "twitterHandle" fields with subfields "first" and "last" for the "name" field):
* **Name:** `relation`
* **UI:** text input with search result dropdown
* **Data type:** data type of the value pulled from the related collection item
* **Options:**
* `collection`: (**required**) name of the referenced collection (string)
* `value_field`: (**required**) name of the field from the referenced collection whose value will be stored for the relation. For nested fields, separate each subfield with a `.` (e.g. `name.first`). For list fields use a wildcard `*` to target all list items (e.g. `categories.*`).
* `search_fields`: (**required**) list of one or more names of fields in the referenced collection to search for the typed value. Syntax to reference nested fields is similar to that of *value_field*.
* `file`: allows referencing a specific file when the referenced collection is a files collection (string)
* `display_fields`: list of one or more names of fields in the referenced collection that will render in the autocomplete menu of the control. Defaults to `value_field`. Syntax to reference nested fields is similar to that of *value_field*.
* `default`: accepts any widget data type; defaults to an empty string
* `multiple` : accepts a boolean, defaults to `false`
* `options_length`: accepts integer to override number of options presented to user. Defaults to `20`.
* **Referencing a folder collection example** (assuming a separate "authors" collection with "name" and "twitterHandle" fields with subfields "first" and "last" for the "name" field):
```yaml
- label: "Post Author"
@ -29,9 +29,9 @@ The relation widget allows you to reference items from another collection. It pr
display_fields: ["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.
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's name is saved for the field.
- **String templates example** (assuming a separate "authors" collection with "name" and "twitterHandle" fields with subfields "first" and "last" for the "name" field):
* **String templates example** (assuming a separate "authors" collection with "name" and "twitterHandle" fields with subfields "first" and "last" for the "name" field):
```yaml
- label: "Post Author"
@ -43,9 +43,9 @@ The generated UI input will search the authors collection by name and twitterHan
display_fields: ["{{twitterHandle}} - {{followerCount}}"]
```
The generated UI input will search the authors collection by name, and display each author's handle and follower count. On selection, the author entry slug will be saved for the field.
The generated UI input will search the authors collection by name, and display each author's handle and follower count. On selection, the author entry slug is saved for the field.
- **Referencing a file collection list field example** (assuming a separate "relation_files" collection with a file named "cities" with a list field "cities" with subfields "name" and "id"):
* **Referencing a file collection list field example** (assuming a separate "relation_files" collection with a file named "cities" with a list field "cities" with subfields "name" and "id"):
```yaml
- label: "City"
@ -58,4 +58,4 @@ The generated UI input will search the authors collection by name, and display e
value_field: "cities.*.id"
```
The generated UI input will search the cities file by city name, and display each city's name. On selection, the city id will be saved for the field.
The generated UI input will search the cities file by city name, and display each city's name. On selection, the city id is saved for the field.

View File

@ -1,57 +1,75 @@
---
label: "Select"
title: select
label: Select
---
The select widget allows you to pick a string value from a dropdown menu.
- **Name:** `select`
- **UI:** select input
- **Data type:** string or array
- **Options:**
- `default`: default values must be contained in `options` and are ignored otherwise
- string values: accepts a string; defaults to an empty string. Accepts an array of strings and defaults to an empty array with `multiple: true` enabled.
- object with `label` and `value` fields: accepts an object with `label` and `value` field or an array of such objects when `multiple: true` is enable. Defaults to no value
- `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
- `multiple`: accepts a boolean; defaults to `false`
- `min`: minimum number of items; ignored if **multiple** is not `true`
- `max`: maximum number of items; ignored if **multiple** is not `true`
- **Example** (options as strings):
```yaml
- label: "Align Content"
name: "align"
widget: "select"
options: ["left", "center", "right"]
```
- **Example** (options as objects):
```yaml
- label: "City"
name: "airport-code"
widget: "select"
options:
- { label: "Chicago", value: "ORD" }
- { label: "Paris", value: "CDG" }
- { label: "Tokyo", value: "HND" }
```
- **Example** (multiple):
```yaml
- label: "Tags"
name: "tags"
widget: "select"
multiple: true
options: ["Design", "UX", "Dev"]
default: ["Design"]
```
- **Example** (min/max):
```yaml
- label: "Tags"
name: "tags"
widget: "select"
multiple: true
min: 1
max: 3
options: ["Design", "UX", "Dev"]
default: ["Design"]
```
* **Name:** `select`
* **UI:** select input
* **Data type:** string or array
* **Options:**
* `default`: `options` must contain any default values
* string values: accepts a string; defaults to an empty string. Accepts an array of strings and defaults to an empty array with `multiple: true` enabled.
* object with `label` and `value` fields: accepts an object with `label` and `value` field or an array of such objects when `multiple: true` is enable. Defaults to no value
* `options`: (**required**) there are two ways to list of options for the dropdown menu:
* string values: the dropdown displays the value directly
* object with `label` and `value` fields: the label displays in the dropdown; the value saves in the file
* `multiple`: accepts a boolean; defaults to `false`
* `min`: minimum number of items; ignored if **multiple** is `false`
* `max`: maximum number of items; ignored if **multiple** is `false`
* **Example** (options as strings):
```yaml
- label: "Align Content"
name: "align"
widget: "select"
options: ["left", "center", "right"]
```
Selecting the `center` option, will save the value as:
```yaml
align: "center"
```
* **Example** (options as objects):
```yaml
- label: "City"
name: "airport-code"
widget: "select"
options:
- { label: "Chicago", value: "ORD" }
- { label: "Paris", value: "CDG" }
- { label: "Tokyo", value: "HND" }
```
Selecting the `Chicago` option, will save the value as:
```yaml
airport-code: "ORD"
```
* **Example** (multiple):
```yaml
- label: "Tags"
name: "tags"
widget: "select"
multiple: true
options: ["Design", "UX", "Dev"]
default: ["Design"]
```
* **Example** (min/max):
```yaml
- label: "Tags"
name: "tags"
widget: "select"
multiple: true
min: 1
max: 3
options: ["Design", "UX", "Dev"]
default: ["Design"]
```