Matt Kraai
2007-Dec-18 06:07 UTC
Markdown is confused by quoted text inside a list inside a list
Howdy,
The following bug report was submitted to the Debian bug tracking
system. I verified that the problem it describes is still present in
the latest beta.
If you reply to this message, please preserve the CC to
456595-forwarded at bugs.debian.org.
----- Forwarded message from Daniel Burrows <dburrows at debian.org> -----
From: Daniel Burrows <dburrows at debian.org>
Subject: Bug#456595: Markdown is confused by quoted text inside a list inside a
list.
To: Debian Bug Tracking System <submit at bugs.debian.org>
Date: Sun, 16 Dec 2007 12:42:12 -0800
Package: markdown
Version: 1.0.1-7
Severity: normal
This example of quoted text inside a list works perfectly, as the
Markdown syntax documentation says it should:
-- snip here --
* Foo.
* Bar:
> Some quoted text inside Bar.
More of Bar.
* Baz.
-- snip here --
Running markdown over this produces the expected HTML:
-- snip here --
<ul>
<li><p>Foo.</p></li>
<li><p>Bar:</p>
<blockquote>
<p>Some quoted text inside Bar.</p>
</blockquote>
<p>More of Bar.</p></li>
<li><p>Baz.</p></li>
</ul>
-- snip here --
However, if the <ul> is inside another <ul>, Markdown gets
horribly
confused:
-- snip here --
+ Item 1.
+ Item 2:
* Foo.
* Bar:
> Some quoted text inside Bar.
More of Bar.
* Baz.
-- snip here --
Markdown turns this into:
-- snip here --
<ul>
<li><p>Item 1.</p></li>
<li><p>Item 2:</p>
<ul>
<li><p>Foo.</p></li>
<li><p>Bar:</p></li>
</ul>
<blockquote>
<p>Some quoted text inside Bar.</p>
</blockquote>
<p>More of Bar.</p>
<ul>
<li>Baz.</li>
</ul></li>
</ul>
-- snip here --
Note that the inner <ul> is closed before the blockquote and re-opened
at the next <li>. I think this behavior is surprising; I would have
expected the blockquote and following text to be part of the <ul>.
It appears that there's a workaround: adding extra indents to the
list item in question and the blockquote gives me what I would expect on
output:
-- snip here --
+ Item 1.
+ Item 2:
* Foo.
* Bar:
> Some quoted text inside Bar.
More of Bar.
* Baz.
-- snip here --
compiles to:
-- snip here --
<ul>
<li><p>Item 1.</p></li>
<li><p>Item 2:</p>
<ul>
<li><p>Foo.</p></li>
<li><p>Bar:</p>
<blockquote>
<p>Some quoted text inside Bar.</p>
</blockquote>
<p>More of Bar.</p></li>
<li><p>Baz.</p></li>
</ul></li>
</ul>
-- snip here --
Daniel
-- System Information:
Debian Release: lenny/sid
APT prefers unstable
APT policy: (500, 'unstable'), (500, 'stable')
Architecture: i386 (i686)
Kernel: Linux 2.6.22-3-686 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) (ignored: LC_ALL
set to en_US.UTF-8)
Shell: /bin/sh linked to /bin/bash
Versions of packages markdown depends on:
ii perl 5.8.8-12 Larry Wall's Practical
Extraction
markdown recommends no packages.
-- no debconf information
----- End forwarded message -----
--
Matt
Michel Fortin
2007-Dec-19 03:23 UTC
Markdown is confused by quoted text inside a list inside a list
Le 2007-12-18 ? 1:07, Matt Kraai a ?crit :> + Item 1. > > + Item 2: > > * Foo. > > * Bar: > > > Some quoted text inside Bar. > > More of Bar. > > * Baz.There are a lot of strange cases with list handling in Markdown. Markdown doesn't follow its own rule about the indent of nested list items... except when it does like for the blockquote here. The spec says that the content of a list item shall be indented by four spaces; the content of Item 2 isn't (nor is the content of Bar), but the content of Bar is. I'm not sure which should be considered a bug: the block quote not nested or Foo, Bar, and Baz not being part of the same list as Item 1 and 2. I've been wondering what to do about this in PHP Markdown for a while, and decided not to move until Markdown.pl does in order to keep the two compatible. Given the amount of Markdown content everywhere, I'm concerned by how many documents such a change would (silently?) break. I certainly hope it gets fixed, and thus I'm glad to see the issue raised again. Michel Fortin michel.fortin at michelf.com http://michelf.com/
Seemingly Similar Threads
- Markdown generates invalid html for a list immediately followed by a quote
- RFC: Lazy syntax for paragraphs, blockquotes and lists
- parsing question - lists and blockquotes
- Markdown-PHP and the single opening quote character
- Markdown, SmartyPants and Wordpress?