Backtick Hickup
Milian Wolff
mail at milianw.de
Thu Aug 9 13:26:49 EDT 2007
Am Donnerstag, 09. August 2007 schrieb Michel Fortin:
> 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?
Well, yes and no ;-) I used the `Backslash escapes.html` testcase inside the
`Markdown.mdtest` folder. But I missed the whitespaces in the corresponding
`*.text` file. I'll have to add them manually in my converter. Corner Case...
> 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
My bad. Thank you for the clarification.
--
Milian Wolff
http://milianw.de
More information about the Markdown-Discuss
mailing list