Incremental parser

Michel Fortin michel.fortin at michelf.com
Mon Sep 3 07:28:03 EDT 2007


Le 2007-09-03 à 1:52, Jacob Rus a écrit :


>> Type these three keys in sequence: [1] [2] [3]

>> getting this:

>> <p>Type these three keys in sequence: <a href="#">1</a> [3]

>> and seeing that in his browser:

>> Type these three keys in sequence: 1 [3]

>

> Notice, this is why I was opposed months ago to the `[foo]` format

> for links, and am still opposed to it now.


Hum, perhaps you've missed it, but there is an optional space between
the two brackets in the current (non-shortcut) reference link syntax
(and it *is* documented). So [this][that] is the same as [this] [that].

The example above had noting to do with single-bracketed shortcut
links and all to do with the hypothetical behaviour of a parser
creating links even when there is no corresponding reference.


> What's the likelihood of the same user typing:

>

> Type these three keys in sequence: [1][] [2][] [3][]

>

> I'd guess vanishingly close to none.


Key sequences probably aren't what you should be looking at for a non-
spaced example. Take a look at this instead:

int[1][2] one_by_two_array;

Sure, a code block or span should be used here, but I think
*requiring* the code block or span here in order to not screw up the
end result isn't the right path to take. Moreover, just look at the
first paragraph I wrote in that email: [this][that] is used as an
example of a Markdown link; perhaps I should have put it in a code
span, or escaped it, but I did not, and perhaps others did the same too.


> If `[foo]` is still allowed as a syntax for links, I would never

> suggest automatically putting links in for `[foo]` unless there is

> a corresponding reference definition, because square brackets are

> far too commonly used for other purposes (and note, TextMate's

> syntax highlighting for markdown wisely does not highlight [this]

> as a link).


Indeed, single-bracketed shortcut links only work because of this
behavior; if you create the link automatically for this syntax you'll
break every Markdown document with square brakets. Note however that
this syntax for links has only been present in beta versions of
Markdown.pl 1.0.2, and beta versions of PHP Markdown 1.0.2, so I'd
think very few people are actually using them. I think John Gruber is
though.


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




More information about the Markdown-Discuss mailing list