This is something in between “wishlist” and “proposal”, in that it’s something I really want, but don’t have the skills to create on my own. So I’m tossing this out into the world with the “lazyweb” tag to see if magic happens at some point.
UPDATE: Though written with Markdown as the initial focus, there are many different text markup systems with text-to-HTML (or other format) and vice versa processors, dating at least back to setext, which itself I think at least partially grew out of existing Usenet conventions at the time. So while my long use of Markdown as the underlying format for my text documents led me to focus there, Markdown itself is just one of many tools which all suffer from the same basic issue of confusing semantics and presentation. I’ve updated the title of this post accordingly and added this paragraph. And now back to the original post….
However much its creator currently bothers me, there’s no denying that Markdown is a very useful way of crafting text documents so that they’re easily convertible to HTML (among other formats).
Various people over the years have identified ways in which the original version of Markdown wasn’t quite what they were looking for, so there are a number of Markdown variants to choose from.
However, every version (at least, every version that I’ve looked into, I haven’t done an exhaustive survey) has the same limitation inherited from the original that drives me up the wall: None of them actually create proper semantic HTML.
In every variant, you have the option to create italicized text by wrapping text in single _underscores_ or *asterisks*, or bold text with doubled __underscores__ or **asterisks**.
However, those don’t actually output <i>/</i> or <b>/</b> tags; instead, they output <em>/</em> and <strong>/</strong> tags.
Now, that is what it says in the original specification, so all downstream implementations are following the lead of the original.
My contention is that this was a bad choice at the time, made worse over the years due to the proliferation of WYSIWYG editors that use buttons marked B and I as shortcuts for adding either Markdown underscores/asterisks or HTML em or strong tags.
Italics are not necessarily emphasis. For example, book titles (which, admittedly, should really be wrapped in <cite>/</cite> tags) are commonly represented with italics, as are the names of ships, such as the U.S.S. Enterprise. And, of course, there may be times when italics are used in a purely presentational manner.
Similarly, bold is not necessarily strong emphasis; it’s often used as a presentational style.
Now, when writing Markdown, since you can incorporate HTML and it just gets passed through to the final rendered HTML, it’s easy enough to create semantic final HTML by writing with a blend of Markdown and HTML markup. (I do this a lot.)
Unfortunately, in HTML to Markdown conversions, both <i> and <em> tags become single underscores or asterisks, both <b> and <strong> tags become doubled underscores or asterisks, and <cite> tags just disappear. There’s no way to retain the original semantics (assuming the original document was properly coded to begin with, of course) in the conversion; if you want clean and correct final output, you’ll have a lot of careful search-and-replace to recreate the semantically appropriate markup.
What I want is a Markdown variant that handles semantics properly in some way.
One possibility (though there may be reasons why these choices wouldn’t work; this is off the top of my head):
_single underscore_: creates<i>/</i>italic tags.__double underscore__: creates<em>/</em>emphasis tags.*single asterisk*: creates<b>/</b>bold tags.**double asterisk**: creates<strong>/</strong>strong emphasis tags.
There’s probably a lot more that could be done to create a Markdown variant that supports text semantics well — citation tags, for example — but these are the ones that keep bothering me.
(And yes, I know there apparently is at least one project called “semantic markdown”, but it seems to be concerned with JSON and AI-readable text, and doesn’t address the particular semantics that I’m grumbling about.)







