Skip to content

Markdown Field

The Markdown field type is an alias of the RichText field type, available for backward compatibility with Netlify/Decap CMS. It provides a rich text editor that allows content editors to create and format content using Markdown syntax.

The widget property for this field type is markdown.

See the RichText field documentation for details on the UI, data type, and available options.

Examples

Standard Markdown Field

This example shows a basic Markdown editor with default settings.

yaml
- name: body
  label: Body
  widget: markdown
toml
[[fields]]
name = "body"
label = "Body"
widget = "markdown"
json
{
  "name": "body",
  "label": "Body",
  "widget": "markdown"
}
js
{
  name: 'body',
  label: 'Body',
  widget: 'markdown',
}

Output example:

markdown
# Welcome to the Markdown Field

This is a sample paragraph in **Markdown** format.

- Item 1
- Item 2
yaml
body: |
  # Welcome to the Markdown Field

  This is a sample paragraph in **Markdown** format.

  - Item 1
  - Item 2
toml
body = """
# Welcome to the Markdown Field

This is a sample paragraph in **Markdown** format.

- Item 1
- Item 2
"""
json
{
  "body": "# Welcome to the Markdown Field\n\nThis is a sample paragraph in **Markdown** format.\n\n- Item 1\n- Item 2\n"
}

We have included a Markdown example output along with YAML, TOML, and JSON representations because a field named body with the Markdown field type would be stored outside of the frontmatter in a Markdown file. If the name of the field were different, the content would be stored in the frontmatter instead.

Released under the MIT License.