Backtick Hickup

John MacFarlane jgm at berkeley.edu
Mon Aug 20 11:17:35 EDT 2007



> >An incremental parser would see '*' and scan for a list of inline

> >elements followed by another '*'.

>

> In the traditional tokenize and build AST, there is no “scanning”

> done per se. The ‘*’ becomes a token which affects the building of

> the AST (which effectively change the state where another ‘*’ will

> “close’ the node we’re building, and thus leave bold).


If the suggestion is that the lexer is going to identify '**' as
a "strong emphasis marker" and '*' as an "emphasis marker," prior
to any parsing, I don't see how that's possible. Consider

***bold** in italics*

***italics* in bold**

There's no way of knowing whether the initial two *'s should start
strong emphasis unless you scan forward.

Btw, I notice that the TextMate syntax highlighter gets these cases
wrong. Markdown.pl gets them wrong too, turning the first into

<p><strong><em>bold</strong> in italics</em></p>

pandoc gets them right:

<p
><em
><strong
>bold</strong
> in italics</em
></p
><p
><strong
><em
>italics</em
> in bold</strong
></p
>

Best,
John



More information about the Markdown-Discuss mailing list