Syntax for extensions

Aristotle Pagaltzis pagaltzis at gmx.de
Fri Feb 15 07:05:30 EST 2008


* Florian Lindner <mailinglists at xgm.de> [2008-02-13 20:35]:

> Is there any special syntax that should be used for such 3rd

> party extensions? How would you do it?


I’ve found that if you don’t mind a somewhat nasty-looking
syntax, plain links are a nice extension point that can be used
for simple functionality without adding any new syntax to
Markdown. F.ex. to support abbreviations, I invented an `abbr:`
link scheme, so that I could write

[RDF](abbr: "Reality Distortion Field")

which Markdown would then translate to

<a href="abbr:" title="Reality Distortion Field">RDF</a>

which a trivial bit of XSLT would turn into

<abbr title="Reality Distortion Field">RDF</abbr>

Pretty? Not at all… but it worked, it was completely independent
of Markdown as such, and also completely independent of any one
particular Markdown implementation.

In your particular use, the use of the URI would not even be a
hack the way it was for mine. Just write your image tags
something like so:

![foo](replace:foo.jpg)

and then use script to replace any `<img src>` URIs in the output
that have the `replace:` scheme with whatever post-determined URI
is appropriate.

You don’t need to meddle with Markdown at all.

Regards,
--
Aristotle Pagaltzis // <http://plasmasturm.org/>


More information about the Markdown-Discuss mailing list