6

I'm working on a CMS platform and I am planning to use CKEditor as it seems to offer everything I need.

One thing that is a bit of a bother to me is that I want my content to be in markdown format instead of html and while I found a BBCode extension for this, I couldn't figure out how it can be remade to support markdown.

I tried to find an editor that does markdown out of the box, but the ones I found are way too simple for what I need and CKEditor has the benefit of having a plugin system to adjust perfectly for me.

Eman
  • 1,093
  • 2
  • 26
  • 49
  • possible duplicate of [Integrated Markdown WYSIWYG text editor](http://stackoverflow.com/questions/12840132/integrated-markdown-wysiwyg-text-editor) – a coder Jun 09 '15 at 19:06

2 Answers2

13

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

Screenshots:

markdown WYSIWYG

markdown source

See also: Integrated Markdown WYSIWYG text editor (2012)

Community
  • 1
  • 1
a coder
  • 7,530
  • 20
  • 84
  • 131
  • 1
    be aware, that the version on ckeditor.com seems to buggy and not working, the newest version on https://github.com/hectorguo/CKEditor-Markdown-Plugin does. see: https://github.com/hectorguo/CKEditor-Markdown-Plugin/issues/8 – Asara Jul 31 '16 at 10:36
  • Thanks man, The new version worked for me :) – nofoobar Mar 15 '22 at 09:34
2

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.

roryok
  • 9,325
  • 17
  • 71
  • 138
Reinmar
  • 21,729
  • 4
  • 67
  • 78
  • Glad to get a response from the core developer, I should have mentioned that the markdown syntax would mainly be for a module that would need a basic set of html available to it, which is why I wanted to use markdown. the actual pages will be HTML. – Eman Mar 10 '14 at 01:27
  • I decided that I'll just do the conversion in PHP. I really only need it for one section so that will be fine since I'd have that ckeditor instance super watered down anyways to basic elements. – Eman Mar 13 '14 at 18:14
  • Hi, Reinmar. How CKEditor handle with embed javascript code? – JerryDDG Oct 23 '14 at 09:29
  • You should ask a new question, because what you asked is unrelated to this one. – Reinmar Oct 23 '14 at 12:05
  • 17
    1. Markdown now has a spec. (http://commonmark.org/); 2. True, but you could simply disable the features that Markdown doesn't support; 3. That depends on what you're using it for. In most cases I'd agree, but the point of Markdown is that it's human readable even when not rendered. This is incredibly useful in things like git patch diffs. – Ajedi32 Feb 09 '15 at 22:13
  • 5
    The appearances of CommonMark changes the situation a lot. It's what Markdown really missed. We'll definitely reconsider having CM support now. – Reinmar Feb 12 '15 at 11:20
  • 2
    @Reinmar any update on CKEditor implementing CommonMark? – a coder Apr 13 '15 at 14:50
  • Not yet. We still consider it a very interesting idea, but I don't want to say that we'll implement it before we'll plan the next milestone. There are dozens "very interesting" ideas in our backlogs :D – Reinmar Apr 13 '15 at 15:31
  • Please keep us updated, there is even more interest on [this thread](http://stackoverflow.com/questions/12840132/integrated-markdown-wysiwyg-text-editor). – a coder Jun 25 '15 at 18:27
  • 1
    fwiw, i'd like to have this just because basic markdown is so much less noisy than html — having html features remain as html is fine. – Eevee Oct 21 '15 at 04:36