Le 2007-08-08 ? 18:29, Milian Wolff a ?crit :
> I'm using Michel Fortin's MDTest cases to rewrite my html2text.php
> script.
> Just now I stumbled upon this bug (in PHP Markdown at least):
>
> # Input:
>
> Backtick: ``\```
>
> # Output:
>
> <p>Backtick: `````</p>
>
> # Should-Be Output:
>
> <p>Backtick: <code>`</code></p>
I understand that this is some test case of your own, is it?
This was the expected output for Markdown 1.0, and it is the actual
output for the corresponding PHP Markdown version 1.0:
<p>Backtick: <code>`</code></p>
There has been a change in version 1.0.1 so that character escapes
inside code spans are ignored. That way, you don't have to double-
escape backslashes in code (that's quite handy). The output generated
by PHP Markdown 1.0.1 looks like this:
<p>Backtick: `````</p>
To come to this result, Markdown first see two blocks of backticks,
one of two backticks `` and one of tree ``` with a backslash \
inbetween. Since the number of backticks do not match, it does not
become a code span and the usual rules for text apply: the backslash
disappear while escaping the first backtick and you get a five-
backtick block.
Since PHP Markdown 1.0.1g, escaped characters are encoded as numeric
entities in the output so they don't have to be double-escaped if you
use PHP SmartyPants. This produce the result you get:
<p>Backtick: `````</p>
You can test all versions of PHP Markdown on the "all-versions"
dingus here:
<http://www.michelf.com/projects/php-markdown/dingus/?all-versions>
Also, if you want a single backtick inside a code block, just write:
Backtick: `` ` ``
This is explained in the [syntax description page][1] on Daring
Fireball.
[1]: http://daringfireball.net/projects/markdown/syntax#code
Michel Fortin
michel.fortin at michelf.com
http://www.michelf.com/