russross / blackfriday

Blackfriday: a markdown processor for Go
Other
5.42k stars 598 forks source link

Indented Block Quote in a list is not parsed as a child to the list item. #555

Open lonnblad opened 5 years ago

lonnblad commented 5 years ago

An indented Block Quote, a Paragraph and a List within a List Item are not parsed as children to that List Item.

markdown

* Foo

  > Bar

  Foo

  - Bar

expected node.Walk

Document
  List
    Item
      Paragraph
        Text
        Emph
          Text
        Emph
        Text
      Paragraph
      BlockQuote
        Paragraph
          Text
        Paragraph
      BlockQuote
      Paragraph
        Text
      Paragraph
      List
        Item
          Paragraph
            Text
          Paragraph
        Item
      List
    Item
  List
Document

actual node.Walk

Document
  List
    Item
      Paragraph
        Text
        Hardbreak
      Paragraph
    Item
  List
  BlockQuote
    Paragraph
      Text
    Paragraph
  BlockQuote
  Paragraph
    Text
  Paragraph
  List
    Item
      Paragraph
        Text
        Hardbreak
      Paragraph
    Item
  List
Document
lonnblad commented 5 years ago

found that indenting with two extra spaces gave what I expected

* Foo

    > Bar

    Foo:

    - Bar
dmoles commented 4 years ago

Glad to have the workaround, but to maximize the readability of the source Markdown (surely one of the major points of using Markdown in the first place!) it would be nice to have the GFM behavior of just having to match the indent of the list item, and not requiring extra newlines.

- in an unordered list
  > indent the child item two spaces
1. in an ordered list
   > indent the child item three spaces
dmoles commented 4 years ago

Doubly indented lists have a similar problem:

- level 1
- level 1
  - level 2
    - level 3
    - level 3
  - level 2

Should produce something like:

with the structure:

<ul>
    <li>level 1</li>
    <li>level 1
        <ul>
            <li>level 2
                <ul>
                    <li>level 3</li>
                    <li>level 3</li>
                </ul>
            </li>
            <li>level 2</li>
        </ul>
    </li>
</ul>

but instead produces:

with the structure:

<ul>
    <li>level 1</li>
    <li>level 1
        <ul>
            <li>level 2</li>
            <li>level 3</li>
            <li>level 3</li>
            <li>level 2</li>
        </ul>
    </li>
</ul>