Markdown Field


The markdown field represents a chunk of Markdown content. This field is typically used for the body of Markdown files.

tinacms-markdown-field

Options

interface MarkdownConfig {
  component: 'markdown'
  name: string
  label?: string
  description?: string
}
OptionDescription
componentThe name of the plugin component. Always 'markdown'.
nameThe path to some value in the data being edited.
labelA human readable label for the field. Defaults to the name. (Optional)
descriptionDescription that expands on the purpose of the field or prompts a specific action. (Optional)

FieldConfig

This interfaces only shows the keys unique to the markdown field.

Visit the Field Config docs for a complete list of options.

Adding the Plugin

The markdown field plugin is not a default plugin. In order to use it in your site you must install the react-tinacms-editor package:

yarn add react-tinacms-editor

You can then add it to your cms:

import { MarkdownFieldPlugin } from 'react-tinacms-editor'

cms.plugins.add(MarkdownFieldPlugin)

Visit the plugins doc to learn how to reduce your initial bundle size by dynamically loading & registering the plugins.

Definition

Below is an example of how a markdown field could be defined in a Gatsby remark form. Read more on passing in form field options.

const BlogPostForm = {
  fields: [
    {
      name: 'rawMarkdownBody',
      component: 'markdown',
      label: 'Post Body',
      description: 'Edit the body of the post here',
    },
    // ...
  ],
}