Skip to content

AsciiDoc writer: List items with list continuations cause malformation of following items, or nested lists #11006

@mikewadsten

Description

@mikewadsten

Explain the problem.
Suppose we are converting the following HTML to AsciiDoc:

<ul>
  <li>
    <p>Paragraph</p>
    <p>Another paragraph</p>
    <ul>
      <li>Nested list</li>
      <li>Nested list item two</li>
    </ul>
  </li>
</ul>

That first list item will contain a list continuation (+ line between the paragraphs). If there isn't a blank line before the nested list (** marker), that marker will be interpreted as an opening bold marker, not a nested list.

Reproduction: https://pandoc.org/try/?params=%7B%22text%22%3A%22%3Cul%3E%5Cn++%3Cli%3E%5Cn++++%3Cp%3EParagraph+one%3C%2Fp%3E%5Cn++++%3Cp%3EParagraph+two+to+force+a+list+continuation%3C%2Fp%3E%5Cn++++%3Cul%3E%5Cn++++++%3Cli%3EFirst+nested%3C%2Fli%3E%5Cn++++++%3Cli%3ESecond+nested%3C%2Fli%3E%5Cn++++%3C%2Ful%3E%5Cn++%3C%2Fli%3E%5Cn%3C%2Ful%3E%5Cn%5Cn%3Cp%3EHow+about+ordered+lists%3F%3C%2Fp%3E%5Cn%5Cn%3Col%3E%5Cn++%3Cli%3E%5Cn++++%3Cp%3EParagraph+one%3C%2Fp%3E%5Cn++++%3Cp%3EParagraph+two+to+force+a+list+continuation%3C%2Fp%3E%5Cn++++%3Col%3E%3Cli%3ENested+item%3C%2Fli%3E%3C%2Fol%3E%5Cn++%3C%2Fli%3E%5Cn%3C%2Fol%3E%22%2C%22to%22%3A%22asciidoc%22%2C%22from%22%3A%22html%22%2C%22standalone%22%3Afalse%2C%22embed-resources%22%3Afalse%2C%22table-of-contents%22%3Afalse%2C%22number-sections%22%3Afalse%2C%22citeproc%22%3Afalse%2C%22html-math-method%22%3A%22plain%22%2C%22wrap%22%3A%22auto%22%2C%22highlight-style%22%3Anull%2C%22files%22%3A%7B%7D%2C%22template%22%3Anull%7D

Rendering that result with AsciiDoctor, or with a tool like https://asciidork-playground.vercel.app/ , demonstrate that we get:

... Another paragraph Nested list Nested list item two

The workaround is to insert a newline before the ** or .. marker, so that instead of:

* Foo
+
bar
** baz

we get:

* Foo
+
bar

** baz

While that workaround can be applied manually, or with a multiline regex ^[+]$\n(^[^*].*\n)+^[*] replaced with +\n\1\n*, needing to do so hinders automated conversion from HTML to AsciiDoc. And I think this should be a fairly simple fix in the writer.

Pandoc version?
Locally I am using pandoc 3.2.1 on Alpine Linux (in a Docker container), but the issue is reproducible on https://pandoc.org/try as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions