fix: escape heading on user message item #4301
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Describe Your Changes
The changes in the provided
git diff
involve two TypeScript files and focus on modifying how markdown text is processed and rendered. Here's a breakdown of what has been changed:MarkdownTextMessage.tsx:
Function Parameter Modification:
MarkdownTextMessage
component's props have been modified to include anisUser
boolean property alongside the existingid
andtext
properties. This is indicated by the change to the function signature from:Markdown Preprocessing:
preprocessMarkdown
to modify the markdown text if theisUser
flag istrue
. The function escapes markdown headings by prefixing them with a backslash. This is done using areplace
method:isUser
prop istrue
.Markdown Component Usage:
text
:index.tsx:
MarkdownTextMessage
component instantiation to include theisUser
prop:In summary, these changes introduce a conditional preprocessing of markdown messages based on the user context (
isUser
), specifically to escape headings in markdown content originating from users.Fixes Issues
Self Checklist