Markdown renders only through a registered MarkdownTemplate
Detect
ui:enableMarkdownInDescriptionorui:enableMarkdownInHelpin youruiSchemaorui:globalOptions.- A custom
translateStringthat returns markdown.
Change
markdown-to-jsx is now an optional peer dependency of @rjsf/core, so it is no longer installed with it. Markdown renders through the MarkdownTemplate, whose core default is plain text. @rjsf/core/markdown provides the markdown-to-jsx implementation.
Install markdown-to-jsx and register the template:
import Form from '@rjsf/core';
+import MarkdownTemplate from '@rjsf/core/markdown';
<Form
schema={schema}
validator={validator}
+ templates={{ MarkdownTemplate }}
uiSchema={{ 'ui:enableMarkdownInDescription': true }}
/>;
ui:enableMarkdownInDescription and ui:enableMarkdownInHelp stay independent, default to false, and can still be set through ui:globalOptions. Translatable strings that allow markdown go through RichDescription, so they also need ui:enableMarkdownInDescription. A custom translateString that returns markdown keeps working once the template is registered and that option is on.
Verify
- Descriptions and help text that used markdown render formatted again.
- Raw HTML in markdown shows as text. It is never parsed.
Also read: