10-Jan-2016
A proposal to support the <mark> tag with Markdown
The HTML5 specification introduced an interesting new tag: <mark>
. You can
use <mark>
to highlight parts of your text.
A first question is how it compares to tags like <strong>
and <em>
. I
found a good answer on Stack Overflow. In summary, <strong>
and
<em>
represent pieces of text that are relevant within the context of the
page. On the other hand, the <mark>
element represents a run of text that is
highlighted due to its relevance in another context.
Upon reflection, I believe that typical surfing behavior is a good application
of <mark>
. Typically, people land on a page "out of context". They will
first glance over it, looking for key phrases to decide whether the content is
interesting for them. Using <mark>
to highlight key phrases may help a
reader to decide whether it is worthwhile to read the content systematically.
In Markdown, we have the option to use HTML tags like <mark>
directly.
However, as I was thinking about this, I realized that there is another
possibility. We can support lightweight markup for this tag by taking
advantage of a redundancy in Markdown. In standard Markdown, you can either
use asterisks (*
) or underscores (_
) to indicate emphasis. What we could do
instead is rendering the underscore (_
) version using <mark>
.
To experiment with this feature, I have implemented it in Urubu as a Markdown extension, and I have been using it on this page. Feedback welcome!