mmarkdown / mmark

Mmark: a powerful markdown processor in Go geared towards the IETF
https://mmark.miek.nl
Other
480 stars 45 forks source link

"Tighten lists" patch leads to illegal XML #107

Closed danielfett closed 4 years ago

danielfett commented 4 years ago

What went wrong?

minimal.xml(25): Error: Element li has extra content: ol, at /rfc/middle/section/ol/li[2]/ol
minimal.xml(3): Error: Invalid document before running preptool.
Unable to complete processing minimal.xml

The problem is that elements are not generated where they should.

What version of mmark are you using?

2.2.4; the bug does not appear in 2.2.3

What command line did you use?

mmark minimal.md > minimal.xml; xml2rfc --html minimal.xml

What platform (Linux/Apple/Windows)?

What is the most minimal markdown snippets that shows the problem?

Define "most minimal" ;-) This is pretty close:

# x

 1. a
 1. b
     1. c
     2. d
 1. e
miekg commented 4 years ago

[ Quoting notifications@github.com in "[mmarkdown/mmark] "Tighten lists" p..." ]

What went wrong?

minimal.xml(25): Error: Element li has extra content: ol, at /rfc/middle/section/ol/li[2]/ol
minimal.xml(3): Error: Invalid document before running preptool.
Unable to complete processing minimal.xml

The problem is that elements are not generated where they should.

What version of mmark are you using?

2.2.4; the bug does not appear in 2.2.3

What command line did you use?

mmark minimal.md > minimal.xml; xml2rfc --html minimal.xml

What platform (Linux/Apple/Windows)?

  • [X] Linux
  • [ ] Apple
  • [ ] Windows

What is the most minimal markdown snippets that shows the problem?

Define "most minimal" ;-) This is pretty close:

# x

1. a
1. b
    1. c
    2. d
1. e

I'll think i'll revert that merge then. As the spec is basically unwritten (it's whatever xml2rfc does today), I can't fallback to back something normative

b---c commented 4 years ago

Well that's a bummer. I was only using flat lies and was rather happy with the tighter lists produced via v2.2.4.

I'm sorry for being a pain. And I'm a little out of my element here but is there any chance the #106 change could go back in but updated so that it doesn't output a paragraph when there are no block level elements and no list elements out that branch of the ast? Or maybe if that point in the ast is a text only leaf with no line breaks? Just a thought/hope...

miekg commented 4 years ago

[ Quoting notifications@github.com in "Re: [mmarkdown/mmark] "Tighten list..." ]

Well that's a bummer. I was only using flat lies and was rather happy with the tighter lists produced via v2.2.4.

I'm sorry for being a pain. And I'm a little out of my element here but is there any chance the #106 change could go back in but updated so that it doesn't output a paragraph when there are no block level elements and no list elements out that branch of the ast? Or maybe if that point in the ast is a text only leaf with no line breaks? Just a thought/hope...

I have no problem bringing it back, but the simple fix was apparently not enough, so this needs some more and I'm not sure I will have the time.

miekg commented 4 years ago

might be actual bug in the parser: https://github.com/gomarkdown/markdown/issues/158

miekg commented 4 years ago

think this fixes the core issues: https://github.com/gomarkdown/markdown/pull/159 If merged (i co-author that repo as well), this patch should be able to get re-applied; together with a test for this particular case.

b---c commented 4 years ago

Thanks for the continued work on this, Miek.