-
Notifications
You must be signed in to change notification settings - Fork 10.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FIX] Emoji are rendered in URL #15516
[FIX] Emoji are rendered in URL #15516
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hey @oguhpereira thanks for your contribution, but your change "skips" the others parsers (like mentions or emojis).
The method we developed to solve this is using tokens
use the replaceFn
argument Autolinker.link(msgPart, {replaceFn ....},
to return a token instead of the original html AND insert on message.tokens
like:
message.tokens.push({ token, text: tag.toAnchorString() })
look how we protect the code parse here app/markdown/lib/parser/original/code.js
app/autolinker/client/client.js
Outdated
@@ -59,7 +59,7 @@ const renderMessage = (message) => { | |||
regexTokens = new RegExp(`(${ (message.tokens || []).map(({ token }) => RegExp.escape(token)) })`, 'g'); | |||
msgParts = message.html.split(regexTokens); | |||
} else { | |||
msgParts = [message.html]; | |||
msgParts = [message.msg]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
msgParts = [message.msg]; | |
msgParts = [message.html]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank's for feedback @ggazzo,
I had not realized, sorry. I rollback my changes and added your changes in my commit
Will this merge affect this issue? #7741 |
Closes #15050
Closes #6770
Closes #12321