Skip to content

Comments

[IMPROVE] Upgrade Marked to 3.0.8 + fix linebreaks#23596

Closed
Karting06 wants to merge 2 commits intoRocketChat:developfrom
Karting06:markedupgrade3
Closed

[IMPROVE] Upgrade Marked to 3.0.8 + fix linebreaks#23596
Karting06 wants to merge 2 commits intoRocketChat:developfrom
Karting06:markedupgrade3

Conversation

@Karting06
Copy link
Contributor

Proposed changes (including videos or screenshots)

Issue(s)

Fixes: #11675 (line break issue)
Fixes: #11214 (emoji)
Closes: #20234
Closes: #23380

Steps to test or reproduce

See details for the line break issue : #11675

Further comments

The implementation of the Original Markdown in Rocket.Chat doesn't add a paragraph HTML tag to each message (<p>message</p>) while Marked.js did. I changed the paragraph renderer to fix that. This also fixed the problem with ASCII emojis (:)) not being parsed by the emoji parser.

Marked Markdown also parsed multiple line breaks as a new paragraph while Original Markdown doesn't. I slightly changed the paragraph rule of Marked Markdown (GFM & normal) in order to keep 1 paragraph. The line breaks are now consistent with Original Markdown.

Regarding the new Marked.js version:
The current version of Marked.js don't have separated em & strong rules anymore instead they use emStrong.
I couldn't migrate the custom inlineLexer rules for strong & em. I also don't really know where they are used in order to test it.

@danel1
Copy link

danel1 commented Nov 11, 2021

@ggazzo @dougfabris can we get this in a release soon? Would be awesome!

@dougfabris
Copy link
Member

dougfabris commented Nov 12, 2021

@Karting06 Thanks a lot for your help. We discussed internally and we are planning to deprecate the marked in the future, replacing it with our own marked solution. Because of that we won't upgrade the marked package. Due this decision I'll close this one and I'm look forward to merge the fixes you have done here: #20234

@dougfabris dougfabris closed this Nov 12, 2021
@Karting06
Copy link
Contributor Author

Ok, thanks for the follow-up @dougfabris.
I hope that Rocket.Chat's marked solution will be similar to the "normal" marked ;)

@danel1
Copy link

danel1 commented Nov 15, 2021

Sorry @dougfabris to disturb you again. Do you really think it's good idea to "re-invent the wheel"? Why not use a framework that is known and well developed? You're just adding another component that you have to maintain yourselves. I think there are enough problems and bugs with self-developed stuff already and ever new release brings more problems than fixing.. IMHO this decision should be overthinked...

@dougfabris
Copy link
Member

@danel1 please, consider this answer about why we're implementing our own parser: #20234 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Marked MD Parser] Line break in messages "Marked" Markdown parser interfering with Emoji transformation

3 participants