nested links

John Gruber gruber at
Wed Dec 22 12:38:16 EST 2004

Stephen Haberman <stephenh at> wrote on 12/19/04 at 3:49pm:

> I really like how my lists line up in a fixed-width font with 2 space
> indentation, though I'll admit that up until now, I've just been
> lucky/sloppy. But since I've found a pretty simple way to support them,
> could lists be officially changed from "4 space or tab" to "1-4 space or
> tab" with this change to _Outdent, or is that too liberal of a spec for your
> tastes?

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

I recall now that, early in Markdown's development (before it was
available as a public beta) Aaron Swartz specifically wanted to be
able to create nested lists using only two spaces for each level of
indentation. I think this worked correctly at one point, and it
certainly explains why the documentation is ambiguous about the
amount of indentation you need to create nested lists.

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.  :^)

This absolutely needs to be clarified and well-specified. Just what
the rules should be, I'm not sure yet.

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

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.

I'm wondering if the best solution might be to introduce a new way
of denoted code bocks, using a line-leading prefix character,
similar to how blockquotes use ">". I'm thinking something like

    *   This is normal text
    *   So is this
        :   this should be a code block

In normal, non-list contexts, this would be in *addition* to the way
that you create code blocks just by indenting them. In other words,
these two examples would be equivalent:

-- 1:

This is a paragraph.

    sub foo {
        print "This is a code block\n";

-- 2:

This is a paragraph.

:   sub foo {
:       print "This is a code block\n";
:   }


More information about the Markdown-Discuss mailing list