php-markdown-extra-extended - my humble attempt at extending php-markdown

David Parsons orc at pell.portland.or.us
Wed Jul 13 21:11:48 EDT 2011



On Jul 13, 2011, at 1:12 PM, Alan Hogan wrote:


>

> On Wednesday, July 13, 2011 at 12:54 PM, David Parsons wrote:

>

>> Adding classes & ids are kind of hideous. What I did with discount

>> was to extend the []() syntax to allow class: and id: pseudo-classes

>> (like [postoffice](class:caps) or version [2.1.0](id:v2.1.0) on spans



> I can’t say I am a fan of this syntax, simply because it uses the

> same exact syntax for hyperlinks as it does for attributes.


Yes, that's by design.


> The only way to tell about a `mailto:` link and a `class:` attribute

> is by whitelisting either attributes or protocols (I'm guessing

> attributes, as protocols are more "unbounded" in quantity). But what

> about obscure attributes? Or `data-foo-bar` attributes? Would (are)

> they be supported in this syntax?


Personally, I've not found much use for passing arbitrary
attributes
into spans or divs, and, at least to the best of my knowledge, no user
has ever asked for that capacity. So it's never been an issue. And
even if it was, I worry about supporting the thing making markdown into
an unreadable mess -- I chose pseudo-protocols for spans because it's a
syntax we've already got, and it makes it no more messy.



> More seriously, what if a new technology takes off that uses a

> protocol designated `id` or similar? Say, a standards-based personal

> identity URL, e.g. id:alanhogan? Then the two sets of meanings would

> overlap.


But it hasn't. And if it does, there's certainly nothing stopping
me from depreciating the pseudo-protocol in future releases of the code;
the nice thing about syntax extensions is that they're understood to be
somewhat experimental and may change to reflect changes in the
underlying
standards.


>

> That said, the ability to apply attributes to spans is pretty cool.

> Naïvely, I would think a syntax like

>

> blah blah [postoffice]{: .caps}


One advantage of using pseudo-protocols is that you can use them
for
the traditional footnote-style link:

[postoffice][caps]

[caps]: class:caps 'ALL UPPER CASE, ALL THE TIME'

You could, of course, subvert the (markdown extra?)-style
abbreviation
syntax to do it silently:

postoffice

%[postoffice]: [postoffice](class:caps)

(or %[postoffice]: [postoffice]{:.caps}, if squiggle-parens are
your thing)


-david parsons


More information about the Markdown-Discuss mailing list