A Markdown WYSIWYM solution for Drupal (or: Markdown for clients that don't sport neck beards)
WYSIWYG editors like FCKeditor and TinyMCE are popular, but in some ways they do more harm than good.
They generate lots of unnecessary HTML
You may think to yourself "Sure, but I'll just filter that stuff out using an input filter". While that will clean up your output somewhat, that unholy mess will still get saved in your database and can cause problems down the line if you want to repurpose your content. Also, if you display the content in teaser form somewhere on your site filtering is necessary since Drupal could potentially insert a teaser break before a closing
</div> generated by the WYSIWYG causing your layout to fall apart.
Pasting from MS Word makes for awful results
Pasting content from Word often generates atrocious results even when using the "Paste from Word" functions. A good example is bullet lists which both FCKeditor and TinyMCE turn into a series of lines preceded by
• entities instead of a proper HTML unordered list. This is obviously very unfortunate since it often looks identical to a properly formatted list in the browser. Many people like to do their writing in Word and it's hard to convince a client to paste the stuff into Windows Notepad as an extra step just to remove cruft that they can't even see, not to mention making your implementation seem very primitive.
An easier Markdown
Markdown is a simple plain text formatting syntax. Markdown syntax can be translated into HTML in Drupal using an input filter with the Markdown filter module. This means less clutter in your database compared to pure HTML and an easier syntax to learn for end-users. It also means that the user is encouraged to focus on semantic rather than aesthetic qualities when formatting the text.
While Markdown is simple compared to HTML, you still need to learn a the syntax which can make it a hard sell when building a site for a non-technical client.
We can alleviate this using a combination of modules:
- BUEditor is an plain text editor with a customizable toolbar. By default BUEditor provides shortcut buttons for HTML.
- Markdown Editor for BUEditor is an add-on for BUEditor that provides a set of Markdown buttons.
- That covers the WYM of our WYSIWYM. For the WYS part, Markdown Preview (by yours truly) inserts a pane below the
Check out the demo to see it in action.