[SVN] Revision 1203 (markdown)

hadley wickham h.wickham at gmail.com
Fri Jun 24 04:05:42 UTC 2005


> If you look at test-minimal, you'll see _italic \_ _ is not italic.  
> 
> According to the markdown syntax:
> "But if you surround an * or _ with spaces, it'll be treated as a literal
> asterisk or underscore."

Ok, thanks for the clarification - I hadn't noticed that part of the
markdown spec.

> So, according to this, the above example should NOT be italic. In fact,
> running "Markdown Preview" shows it to not be italic. That's the purpose of
> my regular expression, to fix this. Alas, as you point out, it does not work
> well with backslash escaping.

That's odd because when I run markdown preview it is italic - however,
this seems to be because they're all in one paragraph.  I've split
each out into it's own paragraph to make this clearer.  I've also
changed _italic \_ _ to _italic\__ to make the test case work (and
match the bold example).  I've also added another test case to
demonstrate _ surrounded by space.

> The purpose of my expression is to consider as italic whatever is between "a
> star or underscore not followed by a space" and "the same symbol not
> preceded by a space or a backslash". Granted, it should be changed so that
> the first star or underscore is also not preceded by an odd number of
> backslashes and the second symbol is not preceded by an even number of
> backslashes, I did forget to take those into account. But the command was
> not working properly in the first place. So neither the original version nor
> my version are correct, as far as I understand. Please correct me if I am
> wrong.

Yes, neither version is correct, so obviously we need to create a
regexp that works for both.  The first step in fixing this is to
improve the test case (which I'll commit shortly) so we can fix it
without breaking anything else.  I also believe that combine the two
forms into one regular expression achieves little but making it more
complicated.

> Also in that file, the 4th line or so is:
> _italic \_ _
> 
> Now, if I understand correctly, this should not be italisized, right?
> 
> But got no responses, so I assumed, and still do, that this statement is
> right. At least markdown seems to think so.

I've been away on holiday, so I must've missed this email.  Yes,
markdown does format that as non-italic, but I'm not entirely sure it
is correct as the final _ is not surrounded by spaces.

Hadley



More information about the textmate-dev mailing list