> >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

_______________________________________________
Markdown-Discuss mailing list
Markdown-Discuss@six.pairlist.net
http://six.pairlist.net/mailman/listinfo/markdown-discuss

Reply via email to