I've spent the last few weeks looking into various textarea enhancements and replacements to make it easier for users to submit HTML formatted text to websites. I've never liked the full on wysiwyg textarea replacements (like tinyMCE or CKeditor). I think they shelter the user too much from HTML. I want to make it easier, but not hide the HTML completely behind the button bloat of a Microsoft Word clone. So I played with wmd-editor, which cleverly bills itself as a wymiwyg (what you see is what you mean) editor which inserts markup for you (in this case Markdown instead of HTML) while showing you a preview of the HTML alongside the textarea. Very nice idea. This is what stackoverflow.com uses. Here's a demo. Note that the contents of the textarea are displayed below the textarea, and the displayed HTML changes as you make changes in the textarea.
But as much as I tried to convince myself that Markdown was a good idea, I just couldn't swallow it in the end. It's no easier to read or to learn than plain HTML, so why not just use the real thing? Safety is one reason, but if you're sanitizing input with HTML Purifier (see last post) this reason loses a lot of it's value.
And also, as cool as the live preview is, it was causing me some problems depending on where the textarea was embedded on the page.
So finally I found Markitup which for me is perfect. It does Markdown, but also has a ton of other options, including HTML (also Textile, Wiki Syntax,, BBcode, or you can roll your own plug-in.) It has something similar to the wmd live preview, except instead of relying fully on javascript for the preview (which I was having trouble modifying because I'm not as fluent in javascript as I am in PHP), Markitup renders a preview on each return (or any time you want it to render by clicking on a preview icon in the toolbar). The preview is shown in an iframe using an ajax call to the server - this way I can process the text with my own PHP code (inserting <br> tags for line breaks, etc...) Perfect. I'm going to be rolling it out to one of my sites for testing this week and I'm incredibly hopeful about it. This is one of the last missing pieces for Geneva.
It's at version 1.1.9 now, but the sneak preview of version 2.0 is blowing my mind. Unfortunately I can't find any info on a release date. The last commits for 1.1.9 were in Oct of 2010. Hopefully it will be soon, as 2.0 has everything I want.
|
But as much as I tried to convince myself that Markdown was a good idea, I just couldn't swallow it in the end. It's no easier to read or to learn than plain HTML, so why not just use the real thing? Safety is one reason, but if you're sanitizing input with HTML Purifier (see last post) this reason loses a lot of it's value.
And also, as cool as the live preview is, it was causing me some problems depending on where the textarea was embedded on the page.
So finally I found Markitup which for me is perfect. It does Markdown, but also has a ton of other options, including HTML (also Textile, Wiki Syntax,, BBcode, or you can roll your own plug-in.) It has something similar to the wmd live preview, except instead of relying fully on javascript for the preview (which I was having trouble modifying because I'm not as fluent in javascript as I am in PHP), Markitup renders a preview on each return (or any time you want it to render by clicking on a preview icon in the toolbar). The preview is shown in an iframe using an ajax call to the server - this way I can process the text with my own PHP code (inserting <br> tags for line breaks, etc...) Perfect. I'm going to be rolling it out to one of my sites for testing this week and I'm incredibly hopeful about it. This is one of the last missing pieces for Geneva.
It's at version 1.1.9 now, but the sneak preview of version 2.0 is blowing my mind. Unfortunately I can't find any info on a release date. The last commits for 1.1.9 were in Oct of 2010. Hopefully it will be soon, as 2.0 has everything I want.
- jim 1-17-2011 12:50 pm