2007-05-18

05/18/2007 21:55:27

I’ve received multiple requests for new features since I first released MultiMarkdown. As MMD has matured, the requests have begun to filter down to the more esoteric and complex — things that basic users don’t need, but advanced users really need. I’ve tried to keep new features to the bare minimum in terms of the markup introduced. It’s important to me that the markup remain as human-readable as possible. I believe it would be impossible to add all of these features and maintain that readability…

A compromise might be possible however. Specifically, it seems that the best approach from this point might be to add the ability to assign classes to various objects in the XHTML output. Specific classes could then be used to add certain features. For example, some users would like to be able to include raw LaTeX code. I could add yet another delimiter to specify that a certain paragraph should be treated like LaTeX code, but perhaps it would be better to assign the class latex, and let an XSLT be developed that “un-processes” the specified section so that it is valid LaTeX. (This approach would be applicable to other target languages, whereas if I alter the MultiMarkdown.pl script to handle this, I could begin a never-ending battle to keep up with requests). This technique could be used to allow codeblocks to represent “code” and “poetry” in the same document. The possibilities are endless, yet it involves only one syntax that can be easily controlled.

The next question is how to implement such a syntax. I was able to find an earlier thread on the Markdown discussion list addressing this idea. No final decisions were made, and I have no idea when (or if) John Gruber is going to implement this idea in Markdown. I would love to wait for his approach so that it will be a “standard”, but if I did that we’d still be waiting on footnotes, tables, and the like.

It appears that the base consensus was for something like:

# This is a header # {h}

{h}: id=header1 class="header red"

And this is a paragraph. {p}

{p}: class="main paragraph"

This could generate the following XHTML:

<h1 id="header1" class="header red">This is a header</h1>

<p class="main paragraph">And this is a paragraph.</p>

Some people have requested that you also be allowed something like this:

# This is a header # {#header1 ."header red"}

And this is a paragraph. {."main paragraph"}

But, IMHO, this is ugly and represents the sort of intrusive markup that Markdown was designed to avoid. I recognize that this is somewhat easier to write, but I really think it gets distracting.

As I mentioned, John has not decided on a standard. So I am left to decide what I think is best for MMD, knowing that it might need to be changed in the future to remain compatible (though this is yet to happen with anything but a subtle change in the output of footnotes, and that was for compatibility with PHP Markdown Extra, not Markdown.)

What do you think? What would be useful, and least intrusive? How big a deal is it to require that classes be assigned in “reference-style” rather than “inline”? Is it worth the effort to program this now, or is it better to wait for the official version and avoid compatibility issues later on?

Similar Pages