Skip to content

Conversation

@ogustavo-pereira
Copy link
Contributor

@ogustavo-pereira ogustavo-pereira commented Oct 4, 2019

Closes #15050
Closes #6770
Closes #12321
Captura de tela de 2019-10-04 20-10-45

Copy link
Member

@ggazzo ggazzo left a 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

msgParts = message.html.split(regexTokens);
} else {
msgParts = [message.html];
msgParts = [message.msg];
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
msgParts = [message.msg];
msgParts = [message.html];

Copy link
Contributor Author

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

@rgembalik
Copy link

Will this merge affect this issue? #7741

@rodrigok rodrigok mentioned this pull request Oct 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants