On markup

I was looking up markup syntaxes recently and realised that one of the reasons I find writing in HTML tedious – apart from the verbosity – is that annotations are loaded up front. Consider this example dummy link pointing back at this post. If I were writing in HTML, I’d write:

Consider this <a href="/2009/09/15/on-markup">example dummy link</a>
pointing back at this post.

Contrast with popular markup languages, say Markdown (in two variations):

1. Consider this [example dummy link](/2009/05/15/on-markup)
   pointing back at this post.

2. Consider this [example dummy link][link] pointing back at this post.

[link]: /2009/05/15/on-markup

Or reStructuredText (two variations):

1. Consider this `example dummy link </2009/05/15/on-markup>`__
   pointing back this post.

2. Consider this `example dummy link`__ pointing back at this post.

__ /2009/05/15/on-markup

Notice how in HTML, the link target, which is an annotation on the text, appears before the text itself? It forces you to break the flow of thought and switch from writing mode to editing mode.

It gets worse when you have more content between the opening and closing.

Some background: I’ve spent a few weeks working on Zine, the blog engine powering this blog. Zine supports multiple markup formats, with the ability to add more via a plugin API. This post is written in Markdown, older posts are in reStructuredText, while the posts imported from LiveJournal use a parser I contributed that converts LJ’s markup to HTML. Because parsers cannot be trusted to be time-efficient, they are called once and the results cached in the database alongside the original text. The cached version is shown when a page is rendered.

Most blogs also have a feature to show only part of a post on the index page and the full text on the post’s own page. In WordPress, this happens when the user places a <!--more--> tag in their text, while LiveJournal uses <lj-cut text="optional cut text">. Zine needs a way to handle this across markup parsers. It does it by implementing a derivative of HTML called, appropriately, Zine Extensible Markup Language, which is basically the same thing as HTML but with a new <intro> tag and some other small features. If you’d like to introduce with a paragraph, cut, then write the rest, it’ll be something like this in ZEML:

<intro>
  <p>
    This is my introductory paragraph.
  </p>
</intro>
<!-- At this point, Zine will cut the post with a Read More link. -->
<p>
  And this is the rest of the post.
</p>

But what if you have a long intro leading to an enticing cut-line? You’ll get:

<intro text="and now, unveil the mystery...">
  <p>
    Blah, blah, blah and blah
  </p>
  <p>
    ...
    ...
    Even more blah
    ...
    ...
    Blah up to a compelling lead-in.
  </p>
</intro>

Whoops! The line that should have been last in your writing sequence moved all the way up to the top.* This is like top-posting in email, but worse: you write your own lines in reverse order.

Consensus in the CMS industry seems to be heading towards discouraging HTML markup and WYSIWYG editors, ushering users instead towards markup languages and limited-ability WYSIWYM editors. I can see why.

* Zine doesn’t actually support the text attribute on the intro tag, but I may add it.

Leave a Reply

You can respond with a photo by tagging it on Flickr with