asciidoctor / kramdown-asciidoc

A kramdown extension for converting Markdown documents to AsciiDoc.
Other
207 stars 19 forks source link

Wrongly translated list continuation in nested lists #118

Closed Vampire closed 7 months ago

Vampire commented 7 months ago

If you have the Markdown

- foo
    - bar
        - baz

      bam

bam continues bar.

This currently is converted to the AsciiDoc

* foo
 ** bar
  *** baz

+
bam

where bam continues foo instead.

It should instead be

* foo
 ** bar
  *** baz

+
bam

+
{empty}

or the imho less nice

* foo
 ** bar
+
--
  *** baz
--
+
bam
mojavelinux commented 7 months ago

Regarding this output:

* foo
 ** bar
  *** baz

+
bam

This is the correct result. The single empty line changes the attachment from baz to bar, which is what it should be doing based on the example you provided.

However, it appears that Asciidoctor is converting it incorrectly. The issue here is actually with Asciidoctor core (which is not too much of a surprise since list parsing in Asciidoctor is still very problematic). We shouldn't change kramdown-asciidoc because Asciidoctor is doing something wrong.

or the imho less nice

kramdown-asciidoc is not going to use open blocks to attach blocks to list items. It's too complex and breaks down if more than one level is needed.

Vampire commented 7 months ago

Oh, I see. From what eskwayrd said on Zulip, I understood the opposite. Can you move this issue to the asciidoctor repo then? Of course Kramdoc should not be changed to adapt to an Asciidoctor bug.

mojavelinux commented 7 months ago

I would prefer if the issue were resubmitted since the description pertains to Kramdown AsciiDoc and thus would not transfer well.

mojavelinux commented 7 months ago

It turns out there is already an issue for this, and has been known for years. See https://github.com/asciidoctor/asciidoctor/issues/2353

In order to fix this, list parsing has to be rewritten in Asciidoctor. This is something we are studying in the AsciiDoc Language. Once we figure it out, the new parsing logic will be put into Asciidoctor.