{h1: Beaten to death by {em: lightweight markup}} Markdown, Textile and other lightweight markup languages are in use everywhere, but are they really the best we can do? Over the past few years {a @href http://en.wikipedia.org/wiki/Lightweight_markup_language: lightweight markup languages} like Markdown and Textile have started to appear everywhere, often replacing some archaic terror from the blue, like BBCode. I have, for the most, seen this happening with a positive light, but recently I've started to question the sense of using these languages: {ol: {li: They are often {em: ambiguous},} {li: and {em: limited} compared to HTML} } In this article I'll be picking on Textile, not because I think it's worse than Markdown, but because it is in my opinion {em: better}. I'm also only going to give one example of each, not because I don't have more, but because it wouldn't add or detract from the point I'm trying to make. {h1: Ambiguous?} Perhaps the best example of how Textile can be ambiguous is when trying to add emphasis to a link, here's the correct way to do it: {pre: *"Example":http://example.com/* OR: "*Example*":http://example.com/} And here's what I often find myself fixing: {pre: *"Example"*:http://example.com/} Who's going to say they where wrong? It seems perfectly reasonable that this should work, except that it {em: doesn't}. {h1: Limited?} Indeed, while a lot of lightweight markup languages make a lot of sense for basic things, paragraphs, images, links and adding emphasis, you could even create a table: {pre: |a|table|row| |a|table|row|} That's pretty simple, and easy, but what if you need a table header? Well, you {em: can't}. {h1: Solution?} There hasn't really been an ideal solution to the problem of providing power and ease of use at the same time. You could keep the lightweight markup features and add to it support for HTML, but then you're faced with another problem -- you need to pay greater attention to sanitising user input, or you'll end up with people killing your layout with a well placed {code: }, which is part of the reason why lightweight markup languages exist in the first place. In the process of building this site I created a {a @href http://github.com/rowan-lewis/htmlformatter/: HTML Formatter} extension for {a @href http://symphony-cms.com/: Symphony CMS} that does just that -- It keeps the barest essentials that you get with a lightweight markup language, but allows you to use whatever HTML you need. You can give it basically anything for input, and it'll give you back valid XML as output. Essentially, it's a two step process: {ol: {li: Run HTML Tidy over the user input,} {li: Apply those lightweight markup features} } Of course, this is grossly simplified, since we're being careful to generate valid XML output, the entire thing must be done with {a @href http://en.wikipedia.org/wiki/Document_Object_Model: DOM manipulation} in PHP. Anyhow, I'd really like to hear other peoples thoughts on this matter, is this a good solution? Too hard, or not enough?