UNPKG

@rjsf/core

Version:

A simple React component capable of building HTML forms out of a JSON schema.

18 lines (17 loc) 778 B
import { jsx as _jsx } from "react/jsx-runtime"; import { getTestIds, getUiOptions, } from '@rjsf/utils'; import Markdown from 'markdown-to-jsx'; const TEST_IDS = getTestIds(); /** Renders the given `description` in the props as * * @param props - The `RichDescriptionProps` for this component */ export default function RichDescription({ description, registry, uiSchema = {} }) { const { globalUiOptions } = registry; const uiOptions = getUiOptions(uiSchema, globalUiOptions); if (uiOptions.enableMarkdownInDescription && typeof description === 'string') { return (_jsx(Markdown, { options: { disableParsingRawHTML: true }, "data-testid": TEST_IDS.markdown, children: description })); } return description; } RichDescription.TEST_IDS = TEST_IDS;