nested links

Stephen Haberman stephenh at chase3000.com
Wed Dec 22 18:32:25 EST 2004


> I'll look at it and consider it going forward.

Cool.

> Also, it explains why Aaron's html2text script -- which turns HTML 
> into Markdown-formatted plaintext -- uses two spaces for each level of 
> nesting in a list.  :^)

Hehe.

> One of the main problems with nested lists is that with 
> multi-paragraph lists, you need to be able to support indented code
blocks. For example:
> 
>     *   This is normal text
> 
>     *   So is this
> 
>             this should be a code block

Actually, with my patch, this works.

Because _Outdent no longer sometimes takes 2, sometimes takes 4, this
snippet:

* Tab
  * Tab, graf one.

    Tab, graf two.

        Code under graf two...

    * Tab

Renders as it should, with "Code under graf two" being a fixed width
paragraph directly under "Tab, graf two" (e.g. the 3rd paragraph in the 2nd
bullet) and then the 3rd tab is correctly nested to a 3rd level after/under
"Code under graf two".

(Note that "Code..." is indented 8 spaces...4 spaces to the "Tab, graf two."
level and then another 4 spaces to make it recognized as code. I point this
out because the "code indent is 4 spaces" rule is not fast and loose like
list indentation but strict at 4 spaces. For example, I tried 6 spaces (4+2)
before "Code under graf two" but then it was seen as just a regular 3rd
paragraph in the 2nd bullet and wasn't turned fixed width.)

> The trick is that it's neither easy nor obvious how to determine when 
> the "this should be a code block" line should be another paragraph in 
> the list item, or a code block in the list item. If you're using tabs 
> or 4-spaces for each level of indent, it's easy.
> If you're using some other amount of spaces for the list items, 
> however, it's tricky.

My intuition thought it would be tricky too, but your great _Outdent
approach, tweaked a little bit to see the minimum outdent (e.g. 2 in my
case) in a block and only outdent by that, seems to work just fine.

- Stephen




More information about the Markdown-Discuss mailing list