|
From: Waylan L. <wa...@gm...> - 2008-02-16 00:07:16
|
Thanks for the report. However, this makes it imposable to represent the string of an escapes backtick "\`" in a code span. >>> import markdown >>> s = "`code with a \` in it`" >>> markdown(s) <p>`code with a ` in it\n<p> A double backtick won't work either. And yes, I realize that the doublebacktick should eliminate the need to escape, but what about when we are trying to represent markdown source in our document? >>> s = "`` code with a \` in it``" <p><code></code>code with a ` in it<code></code>\n</p> This highlights the problem. The string is being broken into two strings with a textnode containing the escaped backtick between. We can't run a pattern across two strings. The patterns code would need to be completely rewritten to fix that. Hmm, while typing this it occurred to me that we should be able to escape the escape character. I believe that presently, this would also create that textnode between two strings though. Maybe the the escape regex could be reworked. I'll see what I can do. On Feb 15, 2008 5:30 PM, Blake Winton <bw...@la...> wrote: > (Apologies if any of you get this twice, I had a hiccup with my mail server.) > (Uh, third time's a charm?) > > Looking at http://daringfireball.net/projects/markdown/syntax.php#backslash > Markdown provides backslash escapes for the following characters: > [...] > ` backtick > > And yet, when I try it in (using markdown-1.6-py2.4.egg) > > ----------- > >>> from markdown import markdown > >>> x = "\\`This should not be in code.\\`" > >>> print x > \`This should not be in code.\` > >>> print markdown( x ) > > <p>\<code>This should not be in code.\</code> > </p> > > > > ----------- > > So I edit the code a little, as so (also attached): > ----------- > === modified file 'markdown.py' > --- markdown.py 2008-02-15 21:28:18 +0000 > +++ markdown.py 2008-02-15 21:28:30 +0000 > @@ -944,9 +944,9 @@ > self.prePatterns = [] > > > - self.inlinePatterns = [ DOUBLE_BACKTICK_PATTERN, > + self.inlinePatterns = [ ESCAPE_PATTERN, > + DOUBLE_BACKTICK_PATTERN, > BACKTICK_PATTERN, > - ESCAPE_PATTERN, > IMAGE_LINK_PATTERN, > IMAGE_REFERENCE_PATTERN, > REFERENCE_PATTERN, > ----------- > > and that gives me: > ----------- > >>> from markdown import markdown > >>> x = "\\`This should not be in code.\\`" > >>> print x > \`This should not be in code.\` > >>> > >>> print markdown( x ) > > <p>`This should not be in code.` > </p> > > > > ----------- > > Which I believe is closer to the spec. > > Thanks, > Blake. > > > > === modified file 'markdown.py' > --- markdown.py 2008-02-15 21:28:18 +0000 > +++ markdown.py 2008-02-15 21:28:30 +0000 > @@ -944,9 +944,9 @@ > self.prePatterns = [] > > > - self.inlinePatterns = [ DOUBLE_BACKTICK_PATTERN, > + self.inlinePatterns = [ ESCAPE_PATTERN, > + DOUBLE_BACKTICK_PATTERN, > BACKTICK_PATTERN, > - ESCAPE_PATTERN, > IMAGE_LINK_PATTERN, > IMAGE_REFERENCE_PATTERN, > REFERENCE_PATTERN, > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Python-markdown-discuss mailing list > Pyt...@li... > https://lists.sourceforge.net/lists/listinfo/python-markdown-discuss > > -- ---- Waylan Limberg wa...@gm... |