Smileyt / python-markdown2

Automatically exported from code.google.com/p/python-markdown2
Other
0 stars 0 forks source link

list+code tags formatting bug #13

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
markdown("* one\n* two\n\n    def func:\n        pass\n")

expected:
u'<ul>\n<li>one</li>\n<li>two</li>\n</ul>\n\n<pre><code>def func:\n   
pass\n</code></pre>\n'

actual:
u'<ul>\n<li>one</li>\n<li><p>two</p>\n\n<p>def func:\n   
pass</p></li>\n</ul>\n'

Original issue reported on code.google.com by vsevolod.balashov on 22 Jan 2008 at 12:54

GoogleCodeExporter commented 8 years ago
mmm...

>>> markdown("\n    def func:\n        pass\n")
u'<p>def func:\n        pass</p>\n'

(expected code block)
may be it`s a bug in my brain...

Original comment by vsevolod.balashov on 22 Jan 2008 at 12:58

GoogleCodeExporter commented 8 years ago
In both cases this is how Markdown.pl (v1.0.1) behaves.

For the original example: there isn't an easy way to disambiguate emiting a code
block (as you expect) or a second paragraph for the list item (the current 
actual
behaviour). Hrm. I'm inclined to follow what Markdown.pl does, for consistency.
However, I could see wanting to allow your expected output *if there were 
another
empty line separating the list and code block*.  E.g.:

  markdown("* one\n* two\n\n\n    def func:\n        pass\n")

For the example in comment 1: Again this is how Markdown.pl behaves, but I 
agree that
I think it is a bug:

>>> from markdown2 import markdown
>>> markdown("    def func:\n        pass\n")
u'<pre><code>def func:\n    pass\n</code></pre>\n'
>>> markdown("\n    def func:\n        pass\n")
u'<p>def func:\n        pass</p>\n'

That leading '\n' should have this effect.

It would be good to bring these up on the markdown-discuss list
(http://six.pairlist.net/mailman/listinfo/markdown-discuss) -- which I'll try 
to do soon.

Original comment by tre...@gmail.com on 23 Jan 2008 at 5:15

GoogleCodeExporter commented 8 years ago
> That leading '\n' should have this effect.

I mean: That leading '\n' should NOT have this effect.

Original comment by tre...@gmail.com on 23 Jan 2008 at 5:16

GoogleCodeExporter commented 8 years ago
I think the original Python Markdown processor addresses this the same way the
popular PHP Markdown processor does, with a "fenced code blocks" extension to 
the
language.

http://www.freewisdom.org/projects/python-markdown/Fenced_Code_Blocks
http://michelf.com/projects/php-markdown/extra/#fenced-code-blocks

Original comment by dsedi...@gmail.com on 2 Nov 2009 at 10:35

GoogleCodeExporter commented 8 years ago

Original comment by tre...@gmail.com on 27 May 2010 at 3:10

GoogleCodeExporter commented 8 years ago
Thanks for opening this ticket! We have the same problem in askbot.

http://askbot.org/en/question/270/formatting-code-after-a-bullet-doesnt-work

Original comment by evgeny.f...@gmail.com on 28 Jan 2011 at 5:54