-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Find a better markdown processor #2314
Comments
I'll be boring here (for those who know me), but – why not using a more stable data format than Markdown? Markdown is broken – there are many flavours, no spec and buggy implementations which are incompatible with each other. Of course, it doesn't make your ticket invalid. We actually implemented this package and people will want to use it. But whenever they try they should think twice whether they really need to. Markdown is like regexp – you have a problem so you pick Markdown to solve it and then you have two problems. |
@Reinmar I agree in 100%, but still it's widely used by editors and CMSes. Maybe such big company like CKSource can takeover this project or at least try to encourage OS community to do it? |
@Reinmar yeah agreed. The reason I filed this ticket for instance was the missing support for RTL in |
If we really were a big company we could consider that, but we're not ;) Besides, we have little business in maintaining a library which we don't use and, what's even more important, which we don't recommend to others (due to the Markdown itself). Anyway, right now we have no resources to put work in this. That's regardless of the option that we'd choose – which is switching to another library or releasing marked2 (inside joke: which could be called CKM, short of CKMarked :D). |
Another Markdown parser suggested by people on the Internet: https://github.com/markdown-it/markdown-it |
Some time ago GitHub moved to CommonMark (with their own extensions): https://github.com/blog/2333-a-formal-spec-for-github-flavored-markdown. This data processor was crated before that and it uses two separate libraries to support conversion to and from GitHubFlavored markdown. I was thinking about creating a CommonMark data processor. It has an official parser that is compatible with the standard. It could be used to convert markdown to our internal format. Thanks to the specification it should be quite easy to write conversion in separate direction. @vladikoff do you think it would be useful for you? |
In our project we are okay for now. We will be looking into improving the |
This is exactly why the CommonMark specification exists. It has a forum for open discussion on how to move the spec forward so that we can expect a fully compatible MD syntax. Additional flavors will always exist like in GitHub/GitLab Flavored Markdown [1][2] which are basically the same. Both share the CommonMark spec as a basis, so I would place my bets there moving forward. With the internal AST structure of the CommonMark reference JS implementation, it should be straight forward to extend the library with a CK5 'renderer' that transforms the AST into the internal format. Basically, any parser that has an internal format will do. I'm also looking into markdown-it due to its extensibility and (among many other plugins), GFM table support. This will get rid of the additional overhead of the intermediate HTML format only to be parsed I am currently in the process of playing with the existing GFM plugin for CKEditor and will start working on such a renderer to transform the CM AST to CKEditors internal format starting next week for a GitHub-flavored Markdown-backed CKEditor at OpenProject. If anyone wants to discuss the bootstrapping of this move, drop me a mail or reach out via Gitter. /edit After discussions with Szymon who started the commonmark experiment in |
I am getting ready to integrate CKEditor 5 and am interested in exporting markdown, so I was wondering what the status is on some of these forks/branches that are looking to improve things before I dive in. Our use of CKE will be limited to basic formatting (bold, italics, links, lists, possibly some font sizing). Anyone have any recommendations? |
And how will font size be represented in your output? |
Essentially, just for headers. Even just having the capability for one header size would be enough. |
Oh, ok. I thought about |
Anyway, what I wrote in https://github.com/ckeditor/ckeditor5-markdown-gfm/issues/16#issuecomment-345672541 is still true from our side. |
Primary interest in transforming to markdown before sending to our server is for safety. Sanitizing HTML input from users can be ... difficult. ;-) Perhaps there are some ckeditor features related to sanitizing that I'm not yet aware of. |
CKEditor is a client-side application so it shouldn't be used for anything related to security. After all, someone can simply bypass it and send you a POST request. As for Markdown being safer... You need a secure Markdown to HTML converter. Please remember that Markdown can contain HTML too. In such a case, sanitizing Markdown... means sanitizing HTML. Of course, perhaps in some converters, you can completely disable support for HTML, but then you should worry about the security of the converter too – I can easily think about potential bugs in Markdown parser that might lead to plain Markdown becoming a dangerous HTML. So, I think that you'd be comparably safe regardless of whether you'll choose some battle-tested HTML sanitiser or a battle-tested Markdown converter. I'd recommend checking https://www.npmjs.com/package/dompurify or https://www.npmjs.com/package/sanitize-html and staying on the good side :D |
@Reinmar is right regarding the security as introducing a different format of a data, which is later transformed into HTML does not add any level of security, if in fact may make things even harder. Reading the following resources may help in understanding what we mean:
In short: if you convert to HTML at some point, you should sanitise the final HTML output anyway. |
I love this quote:
|
I've just stumbled upon this post: https://talk.commonmark.org/t/beyond-markdown/2787. Great read about complexities inherited from Markdown. |
@vladikoff, @mlewand I think this issue can be closed because marked is under active development again? |
As per #7307 comments - It looks that not doing it was a good move as marked was brought back to life ;). Let's close this as we decided to stay with marked. |
marked with over 300 issues and 166 pull requests the library is not maintained anymore. The last release was 10 months ago :(
Ref: markedjs/marked#938
Ref: compodoc/compodoc#349
Ref: https://github.com/showdownjs/showdown
The text was updated successfully, but these errors were encountered: