Fiddle: stop rendering raw html in markdown#243
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the markdown rendering components to stop parsing raw HTML by default while allowing explicit opt-in for HTML parsing on the main Markdown component, and documents the new behavior in the changelog.
Changes:
- Add
disableParsingRawHTMLtoMarkdownTextso inline markdown never parses raw HTML. - Add a new
shouldEnableHtmlParsingprop toMarkdownand wire it tomarkdown-to-jsx’sdisableParsingRawHTMLoption (HTML disabled by default). - Update the changelog to record the new
Markdownprop and behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/molecules/markdownText/component.tsx |
Forces MarkdownText to disable raw HTML parsing, but currently conflicts with its newline handling strategy. |
src/molecules/markdown/component.tsx |
Introduces shouldEnableHtmlParsing and disables raw HTML parsing by default in the core Markdown renderer. |
CHANGELOG.md |
Documents the addition of shouldEnableHtmlParsing on Markdown under the Unreleased/Changed section. |
| <MarkdownToJsx | ||
| options={{ | ||
| forceWrapper: true, | ||
| disableParsingRawHTML: true, | ||
| wrapper: React.Fragment, |
There was a problem hiding this comment.
Setting disableParsingRawHTML: true here breaks the existing newline handling logic, since content is built using literal <br/> tags (see the source.replace call above) and markdown-to-jsx will now render those as plain text rather than line breaks. To preserve the current visual behavior while disabling raw HTML, the newline transformation should be updated to avoid injecting <br/> (e.g. rely only on markdown line-break syntax or another non-HTML approach) so that the WithNewlines story and other multiline content do not show raw <br/> characters in the UI.
Description
Screenshots:
Checklist: