-
-
Notifications
You must be signed in to change notification settings - Fork 833
Conversation
Marked has some annoying bugs, and the author is inactive, so replace it with commonmark.js, which is the reference JavaScript implementation of CommonMark. CommonMark is also preferable since it has a specification, and a conformance test suite to make sure that parsers are correct. Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
Can one of the admins verify this patch? |
par = par.parent | ||
} | ||
if (par.firstChild != par.lastChild) { | ||
real_paragraph.bind(this)(node, entering); |
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.
Did you want real_paragraph.call(this, node, entering)
here? (It's effectively the same, just doesn't make a bound function).
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.
Cool, don't do a lot of JS.
This generally seems like a pretty good idea, although it will break a couple of little bits of syntax we currently support from GFM. To be precise, I believe these are strikethrough and tables. If we like, we can turn off the 'safe' option to allow HTML tags through, which will just let people type HTML into the box and it end up in the message, which is no worse than you could do by posting the same HTML using the API directly. OTOH, typing mixed HR characters like Anyone object? |
Yeah, I'm planning on looking into it for the rest too, but wanted to see if this would be accepted before doing the extra work. |
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
Personally, I'd rather keep using GFM - it's more feature-rich than Commonmark.
Which in particular are affecting you?
Whilst that is nice, I don't agree that we should |
For me, the consistent spec and better-maintained library offset the loss of strikethrough. |
Two things off the top of my head being three or more, with any combination of And with HTML enabled, which as mentioned won't allow anything malicious that wouldn't otherwise be possible, you can use |
I fixed another markdown bug related to escaping markdown characters btw, but it either depends on this patch, or needs to be reimplemented for the current code, which I would rather not work on unless this is rejected. |
Looks like I'm the only one holding out for GFM. Use of I'm happy for us to swap to Commonmark. |
Matthew says:
@ylecollen, @giomfo: wdyt? |
Manu and I agree to swap to Commonmark in Riot iOS (A new issue has been filed: element-hq/element-ios#862) |
The mobile clients have a markdown parser and a markdown renderer. This update will only update the parser side. |
I would be happy to use the same library on all platforms as it was a pain to make iOS and Android MD work like the web client. |
Ok, it sounds like we are all agreed in principle that the switch to CommonMark is a good idea \o/. Now all we have to do is make it happen. I think consistency is important so I think we shouldn't merge this patch until we have support in the iOS and Android apps ready to go too. @kyrias: did you have any interest in replicating this on the mobile apps? |
I have never done any Android/iOS development, but I could certainly try if no one else gets to it before me. |
Is there any unit tests set to ensure that the client parses properly ? |
https://github.com/jgm/CommonMark is the commonmark test suite, but there's none for matrix-react-sdk. |
I haven't really had the time or energy to even start looking at the Android or iOS part of this, but it seems like there's a pure Java implementation that works on Android, and either a pure Swift implementation or the C reference implementation for iOS. |
As per element-hq/element-web#2870 (comment) - We're pushing ahead with CommonMark. Merging. |
FTR, it has been added to Matrix iOS kit thanks to matrix-org/matrix-ios-kit#248 |
Marked has some annoying bugs, and the author is inactive, so replace it
with commonmark.js, which is the reference JavaScript implementation of
CommonMark. CommonMark is also preferable since it has a specification,
and a conformance test suite to make sure that parsers are correct.