Skip to content

Conversation

@Suyog241005
Copy link
Contributor

Reasons for making this change

This PR implements the ability to render markdown in help text fields across all themes by introducing a new ui:enableMarkdownInHelp flag, similar to the existing ui:enableMarkdownInDescription functionality.

-Updated all theme packages to support markdown in help text

Fixes 4601

Checklist

  • I'm updating documentation
  • I'm adding or updating code
    • I've added and/or updated tests. I've run npx nx run-many --target=build --exclude=@rjsf/docs && npm run test:update to update snapshots, if needed.
    • I've updated docs if needed
    • I've updated the changelog with a description of the PR
  • I'm adding a new feature
    • I've updated the playground with an example use of the feature

@Suyog241005 Suyog241005 force-pushed the fix/#4601-added-UiSchema-enableMarkdownInHelp-flag branch 2 times, most recently from 6e9390a to e7391fd Compare November 6, 2025 13:08
@Suyog241005
Copy link
Contributor Author

Hi @heath-freenome , all the test cases for this PR have passed successfully. Could you please review it when you get the chance and let me know if any further changes or improvements are needed before merging?

@Suyog241005 Suyog241005 force-pushed the fix/#4601-added-UiSchema-enableMarkdownInHelp-flag branch from e7391fd to b337908 Compare November 6, 2025 18:46
Copy link
Member

@heath-freenome heath-freenome left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, please add test to formTest.tsx in snapshot-tests to verify the markdown help

@heath-freenome heath-freenome changed the title added the ui:enableMarkdownInHelp flag in UiSchema Feature: added the ui:enableMarkdownInHelp flag in UiSchema Nov 6, 2025
Comment on lines -103 to +102
colon={colon}
hasFeedback={schema.type !== 'array' && schema.type !== 'object'}
help={(!!rawHelp && help) || (rawErrors?.length ? errors : undefined)}
help={help || (rawErrors?.length ? errors : undefined)}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious about this change... Why remove !!rawHelp?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Suyog241005 Still wondering about this...

@Suyog241005 Suyog241005 force-pushed the fix/#4601-added-UiSchema-enableMarkdownInHelp-flag branch 2 times, most recently from 398ab33 to 17938e6 Compare November 7, 2025 13:16
@heath-freenome
Copy link
Member

@Suyog241005 If you could respond to my questions I've left in the review, I'd appreciate it

@Suyog241005
Copy link
Contributor Author

@heath-freenome I’ve updated the changelog as requested. Please let me know if anything else needs adjustment.

Copy link
Member

@heath-freenome heath-freenome left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few more changes

Comment on lines 18 to 37
const uiOptions = getUiOptions<T, S, F>(uiSchema, registry?.globalUiOptions);
if (typeof help === 'string' && uiOptions.enableMarkdownInHelp) {
return (
<div id={id} className='help-block'>
<Markdown options={{ disableParsingRawHTML: true }}>{help}</Markdown>
</div>
);
}
if (typeof help === 'string') {
return (
<p id={id} className='help-block'>
{help}
</p>
);
}
return (
<div id={id} className='help-block'>
{help}
</div>
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simplify this down to just this:

Suggested change
const uiOptions = getUiOptions<T, S, F>(uiSchema, registry?.globalUiOptions);
if (typeof help === 'string' && uiOptions.enableMarkdownInHelp) {
return (
<div id={id} className='help-block'>
<Markdown options={{ disableParsingRawHTML: true }}>{help}</Markdown>
</div>
);
}
if (typeof help === 'string') {
return (
<p id={id} className='help-block'>
{help}
</p>
);
}
return (
<div id={id} className='help-block'>
{help}
</div>
);
return (
<div id={id} className='help-block'>
<Markdown options={{ disableParsingRawHTML: true }}>{help}</Markdown>
</div>
);

Comment on lines 17 to 23
if (typeof help === 'string') {
return (
<p id={id} className='help-block'>
<p id={helpId(fieldPathId)} className='help-block'>
{help}
</p>
);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this section... We don't need the <p> version

return (
<Form.Text className={hasErrors ? 'text-danger' : 'text-muted'} id={id}>
{help}
<Form.Text id={helpId(fieldPathId)} className='text-muted'>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please restore the text-danger logic

@Suyog241005 Suyog241005 force-pushed the fix/#4601-added-UiSchema-enableMarkdownInHelp-flag branch from cbae16f to c918d74 Compare November 8, 2025 14:31
…estored text-danger logic in Bootstrap FieldHelpTemplate & updated core test to expect div.help-block instead of p.help-block
@Suyog241005 Suyog241005 force-pushed the fix/#4601-added-UiSchema-enableMarkdownInHelp-flag branch from c918d74 to 472829c Compare November 8, 2025 14:46
@Suyog241005
Copy link
Contributor Author

Hi @heath-freenome, I’ve implemented all the requested changes.

Could you please review the latest updates when you get a chance?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a new UiSchema ui:enableMarkdownInHelp flag

2 participants