Repository navigation
fix(markups): render markdown images in messages - #1447
Open
anikethinge wants to merge 2 commits into
Open
anikethinge wants to merge 2 commits into
anikethinge wants to merge 2 commits into
Conversation
Contributor
|
Hey @anikethinge! 👋 Great initiative adding markdown I pulled your branch and tested the implementation locally, and noticed a couple of edge cases worth checking out:
Hope this helps! Let me know what you think. 🚀 |
Author
|
Thanks for the thorough review @swarnendusahu10-dotcom — good catches! Updated
|
Contributor
|
@anikethinge welcome ;) |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What?
Adds an
ImageElementcomponent in@embeddedchat/markupsand handlesIMAGEnodes inInlineElements.Why?
Fixes #1432. Previously,
@rocket.chat/message-parserIMAGEnodes (and) fell through todefault: return nullinInlineElements.js, causing markdown images to disappear.How?
packages/markups/src/elements/ImageElement.js:srcURLs to allow onlyhttp:,https:, or single-slash relative paths (blockingjavascript:,data:, and protocol-relative//URLs).alttext safely for string, object, array, or empty labels.<img>inside an<a>tag withrel="noopener noreferrer"andtarget="_blank".case 'IMAGE':inpackages/markups/src/elements/InlineElements.js.Verification
npm run lint— passednpm run format:check— passednpm run build— passed