Skip to content

Commit ef80ebb

Browse files
Fix markdown in descriptions rendering (#4597)
* 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"> * - Fixed daisyui Theme changing to cleanup the tailwind styles * - Moved checkbox implementation into the `CheckboxWidget` * - Updated the `CHANGELOG.md` to document another `daisyui` change * - Fixed build and playground ajv issue
1 parent 0d3515b commit ef80ebb

File tree

63 files changed

+315462
-727433
lines changed

Some content is hidden

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

63 files changed

+315462
-727433
lines changed

CHANGELOG.md

+53
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,59 @@ 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+
- Updated `FieldTemplate` to move the checkbox implementation into the `CheckboxWidget` adding the `description` for checkboxes
37+
- Updated `package.json` to make the package publishable
38+
- Updated `DaisyUIFrameProvider` to extract the bulk of the code into `DaisyUIFrameComponent` to add a `useEffect()` with a cleanup to remove the tailwind styles
39+
40+
## @rjsf/fluentui-rc
41+
42+
- Updated `DescriptionField` to render the `description` using the `RichDescription` field
43+
44+
## @rjsf/mui
45+
46+
- Updated `DescriptionField` to render the `description` using the `RichDescription` field
47+
48+
## @rjsf/react-bootstrap
49+
50+
- Updated `DescriptionField` to render the `description` using the `RichDescription` field
51+
- Updated `CheckboxField` to remove the `checkbox` class that breaks the UI
52+
53+
## @rjsf/semantic-ui
54+
55+
- Updated `DescriptionField` to render the `description` using the `RichDescription` field
56+
57+
## @rjsf/shadcn
58+
59+
- Updated `DescriptionField` to render the `description` using the `RichDescription` field
60+
61+
## @rjsf/utils
62+
63+
- Updated the `description` field in field props to be a `string | ReactElement` and added `enableMarkdownInDescription` to the `GlobalUISchemaOptions` interface
64+
65+
## Dev / docs / playground
66+
67+
- 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`
68+
- Updated the `uiSchema.md` to document new `enableMarkdownInDescription` prop
69+
- Updated the `playground` to move `daisyui` theme choice after `chakra-ui` and to stop freezing the samples to avoid an `AJV` validation issue
70+
1871
# 6.0.0-beta.1
1972

2073
## @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)