Skip to main content
Markdown converters are synchronous. They receive a sanitized editor config, which you can retrieve through editorConfigFactory.

Rich Text to Markdown

Use the configuration from the actual field when it has custom features:

Markdown to Rich Text

The editor config must include every feature whose nodes or transformers appear in the content. A default config does not include your custom blocks.

Converting files

Standard Markdown image syntax does not identify a file record. UploadFeature recognizes this placeholder format:
The first part is the upload collection slug and the second is the record ID. Markdown-to-Lexical conversion creates an upload node from the placeholder. Lexical-to-Markdown conversion emits the same placeholder when the file record is not populated; populated records can produce standard image syntax with a URL and alt text. For existing Markdown images:
  1. Upload the images to your files collection.
  2. Replace each image URL with ![files:<record-id>](), using your actual collection slug.
  3. Convert the resulting Markdown.
When converting back to Markdown, an unpopulated file node uses the placeholder format. A populated file can instead become normal image syntax containing its URL and alt text.

Converting MDX

Markdown converters live on features. MDX converters for custom blocks live on each block’s jsx property.

Defining a custom block

This Banner block converts nested Rich Text to an MDX child and restores that child when importing MDX:
The export callback returns children for content between the MDX tags and props for attributes on the opening tag. The import callback receives those values and returns the block’s field data. The block’s jsx property accepts: