Open 3kami3 opened 1 year ago
@amyblais could you assign this issue to me?
@sugamadhiakri are you still working in this issue?
Can I take this up? @amyblais
Hey @amyblais, It seems to me like there's some issue with how the text is parsed by the "marked" library for markdown content.
As you can see in the below file -
the output is - '1. test\npatch\n1\n\n3\n
' (which is fine, cause it has 1 new line b/w 1 & 3 - 1 & 3)
but, as soon as the Makrdown.format() function is called (which is calling some functions that have input given by the markdown lib at some point in it's journey), the output changes to -
Which has 2 lines in b/w 1 & 3
See below how the code function is called with - '1\n\n\n3' (2 lines b/w 1 & 3; and this input has been I think given by the markdown file)
So, if there's any dev that has some perspective on this, that'd be great!
Thanks!
Edit: Marked library link - https://marked.js.org/
It seems to me like there's some issue with how the text is parsed by the "marked" library for markdown content. . . .
@3kami3 Feel free to come join our "Contributors" community channel on the Mattermost Community server, where you can discuss questions with community members and the Mattermost core team. For technical advice or questions, please join our "Developers Server" community channel.
@adityasoni2019 Great find there. I would've expected that the bug would've been something with how we render the code block, not in the Markdown code itself.
We actually use a heavily modified fork of Marked, so perhaps there's something we've changed which is making that happen? The code for that is here: https://github.com/mattermost/marked
Taking a quick look through that, I noticed this commit where I made some changes to how whitespace in code blocks are handled:
https://github.com/mattermost/marked/commit/cd82cf9e4d1b1a8bcfc1389e9d2f13ac7800e541
That sounds like it could be related to this issue. It was a fix for https://github.com/mattermost/mattermost/issues/6865
Thanks for looking into it, @hmhealey. I was wondering if there's a way to put debuggers on the marked library codebase, while running my mattermost/mattermost? If not, any recos on how to debug it?
Edit: Also, for checking if my changes on the marked lib have resolved the bug I can just change this line (in package.json) according to my personal fork, right? -
"marked": "github:mattermost/marked#2ef7f28cc7718e3f551c4ce9ea75fdd7580c2008",
Summary
The bug is that extra blank lines are inserted when lists (1.,2.,3.,,) and code blocks (```) are used together.
Steps to reproduce
VERSIONS
mattermost/mattermost-team-edition:7.9.1
OPARATION
Enter the following markdown code block as a message input.