Skip to content

Commit a5c626c

Browse files
Fix markdown in descriptions rendering
Reimplements #4405 in v6 In the fields of type `object` and type `boolean`, markdown will be rendered in the description when `enableMarkdownInDescription` is set to `true`. Issue reporting this bug: #3975 Previous PR to add the feature: #3665 The result: <img width="1484" alt="Screenshot 2024-12-01 at 18 44 54" src="https://github.com/user-attachments/assets/46bcf958-2da3-4706-a855-825fd73e1b27">
1 parent a754e6e commit a5c626c

File tree

46 files changed

+50276
-2307
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+50276
-2307
lines changed

CHANGELOG.md

+47
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,53 @@ it according to semantic versioning. For example, if your PR adds a breaking cha
1515
should change the heading of the (upcoming) version to include a major version bump.
1616
1717
-->
18+
# 6.0.0-beta.2
19+
20+
## @rjsf/antd
21+
22+
- Updated `DescriptionField` to render the `description` using the `RichDescription` field
23+
24+
## @rjsf/chakra-ui
25+
26+
- Updated `DescriptionField` to render the `description` using the `RichDescription` field
27+
28+
## @rjsf/core
29+
30+
- Added new `RichDescription` component, refactored from `SchemaField` to support Rich Text descriptions in Markdown format
31+
- Updated `DescriptionField` to render the `description` using the `RichDescription` field
32+
33+
## @rjsf/daisyui
34+
35+
- Updated `DescriptionField` to render the `description` using the `RichDescription` field
36+
37+
## @rjsf/fluentui-rc
38+
39+
- Updated `DescriptionField` to render the `description` using the `RichDescription` field
40+
41+
## @rjsf/mui
42+
43+
- Updated `DescriptionField` to render the `description` using the `RichDescription` field
44+
45+
## @rjsf/react-bootstrap
46+
47+
- Updated `DescriptionField` to render the `description` using the `RichDescription` field
48+
49+
## @rjsf/semantic-ui
50+
51+
- Updated `DescriptionField` to render the `description` using the `RichDescription` field
52+
53+
## @rjsf/shadcn
54+
55+
- Updated `DescriptionField` to render the `description` using the `RichDescription` field
56+
57+
## @rjsf/utils
58+
59+
- Updated the `description` field in field props to be a `ReactNode`
60+
61+
## Dev / docs / playground
62+
63+
- Updated the `snapshot-tests` to disable `getTestId()` for snapshots and updated the `formTests.tsx` to add tests for rich text descriptions for generic fields and the `CheckboxWidget`
64+
1865
# 6.0.0-beta.1
1966

2067
## @rjsf/antd

README.md

+14-8
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,20 @@
2727

2828
## Supported Themes
2929

30-
- [Ant Design](https://github.com/rjsf-team/react-jsonschema-form/tree/main/packages/antd)
31-
- [Bootstrap 3](https://github.com/rjsf-team/react-jsonschema-form/tree/main/packages/core)
32-
- [React-Bootstrap (Bootstrap 5)](https://github.com/rjsf-team/react-jsonschema-form/tree/main/packages/react-bootstrap)
33-
- [Chakra UI](https://github.com/rjsf-team/react-jsonschema-form/tree/main/packages/chakra-ui)
34-
- [Daisy UI](https://github.com/rjsf-team/react-jsonschema-form/tree/main/packages/daisyui)
35-
- [Fluent UI 9](https://github.com/rjsf-team/react-jsonschema-form/tree/main/packages/fluentui-rc)
36-
- [Material UI 5](https://github.com/rjsf-team/react-jsonschema-form/tree/main/packages/mui)
37-
- [Semantic UI](https://github.com/rjsf-team/react-jsonschema-form/tree/main/packages/semantic-ui)
30+
- [Ant Design v5](https://github.com/rjsf-team/react-jsonschema-form/tree/main/packages/antd)
31+
- [Bootstrap v3](https://github.com/rjsf-team/react-jsonschema-form/tree/main/packages/core)
32+
- [Chakra UI v3](https://github.com/rjsf-team/react-jsonschema-form/tree/main/packages/chakra-ui)
33+
- [Daisy UI v5](https://github.com/rjsf-team/react-jsonschema-form/tree/main/packages/daisyui)
34+
- [Fluent UI v9](https://github.com/rjsf-team/react-jsonschema-form/tree/main/packages/fluentui-rc)
35+
- [Material UI v5 & v6](https://github.com/rjsf-team/react-jsonschema-form/tree/main/packages/mui)
36+
- [React-Bootstrap (Bootstrap v5)](https://github.com/rjsf-team/react-jsonschema-form/tree/main/packages/react-bootstrap)
37+
- [Semantic UI v2](https://github.com/rjsf-team/react-jsonschema-form/tree/main/packages/semantic-ui)
38+
- [Shad CN](https://github.com/rjsf-team/react-jsonschema-form/tree/main/packages/shadcn)
39+
40+
## API Libraries
41+
42+
- [@rjsf/utils](https://github.com/rjsf-team/react-jsonschema-form/tree/main/packages/utils)
43+
- [@rjsf/validator-ajv8](https://github.com/rjsf-team/react-jsonschema-form/tree/main/packages/validator-ajv8)
3844

3945
## Documentation
4046

packages/antd/src/templates/DescriptionField/index.tsx

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { DescriptionFieldProps, FormContextType, RJSFSchema, StrictRJSFSchema } from '@rjsf/utils';
2+
import { RichDescription } from '@rjsf/core';
23

34
/** The `DescriptionField` is the template to use to render the description of a field
45
*
@@ -9,9 +10,13 @@ export default function DescriptionField<
910
S extends StrictRJSFSchema = RJSFSchema,
1011
F extends FormContextType = any,
1112
>(props: DescriptionFieldProps<T, S, F>) {
12-
const { id, description } = props;
13+
const { id, description, registry, uiSchema } = props;
1314
if (!description) {
1415
return null;
1516
}
16-
return <span id={id}>{description}</span>;
17+
return (
18+
<span id={id}>
19+
<RichDescription description={description} registry={registry} uiSchema={uiSchema} />
20+
</span>
21+
);
1722
}

0 commit comments

Comments
 (0)