CKEditor - have it return markdown syntax instead of HTML

喜你入骨 提交于 2019-12-03 16:52:08
Reinmar

Using Markdown instead of HTML is a very bad idea for several reasons:

  1. Markdown has no spec, so every library works differently in details. The output which you'll produce using CKEditor may give a different (even totally wrong) result when transformed to HTML by your back-end. For example - escaping image's title and link texts - you won't be able to ensure that the text user inserted does not break the output.
  2. Not all HTML can be transformed to Markdown.
    • There are plenty of tricky cases which are totally correct in HTML, but cannot be done in Markdown.
    • Markdown has fewer features than HTML, so you'd lose some content which users produced.
  3. You actually gain nothing by using Markdown instead of HTML.

I am a CKEditor core developer, so I know it very well. I tried to implement a Markdown writer for CKEditor and very quickly I found that it's completely pointless. I don't say that it's not possible, because it is, but only a limited stability can be achieved - too low for anything I would personally want to use in production.

a coder

CKEditor now has a Markdown addon that does this exact thing. The addon project is hosted on github.

Screenshots:

See also: Integrated Markdown WYSIWYG text editor (2012)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!