`time` element syntax

Michel Fortin michel.fortin at michelf.com
Thu Jun 2 14:31:00 EDT 2011


Le 2011-06-02 à 5:08, David Chambers a écrit :


> Hi folks,

>

> I expect that the response to this post will be "we don't need such a

> thing", but humour me for a moment by pretending that in fact we do.

>

> HTML5 added a number of new tags to the mix, but arguably the most

> significant is the `time` element. It associates a machine-readable

> timestamp with a human-readable string (e.g. `<time

> datetime="2011-05-30T15:00-07:00">30 May 2011</time>`).

>

> I would love to be able to write something like `[30 May

> 2011]{2011-05-30T15:00-07:00}`.

>

> `/^(\d{4})-(\d\d)-(\d\d)T(\d\d):(\d\d)(?::(\d\d)(?:[.](\d+))?)?([-+]\d\d:\d\d|Z)$/`

> could be used to ensure that only valid `datetime` attribute values are

> matched. This would avoid false positives and would keep `[foo]{bar}`

> available for other functions, potentially.

>

> Are there any reasons not to use `[human]{computer}`? Can anyone suggest a

> better syntax?


Personally, I think if you're going to write a lot of dates like this the best syntax would be to auto-detect "30 May 2011" as a date. But this might need to be done at another layer than Markdown since Markdown doesn't know about your time zone and the date format might depend on your language and locale.

--
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/





More information about the Markdown-Discuss mailing list