crowdagger / crowbook

Converts books written in Markdown to HTML, LaTeX/PDF and EPUB

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Headers inside blockquotes translate into an incorrect LaTeX

dvalter opened this issue · comments

Version

0.15.0 (cargo) / 0.15.1 (git)

Target

pdf/tex

Steps to reproduce

crowbook -s test.md -o test.pdf --to pdf --verbose
test.md
Text

> ##### H5
> Text

Text

Error

LaTeX fails with on \mdblockquote

! LaTeX Error: Something's wrong--perhaps a missing \item.

Reasoning

According to this issue, using \paragraph (and other structure related elements) inside \quotation is incorrect and weird errors here are fine.

Real world example

rust-lang/book: src/ch03-02-data-types.md#L101

I would indeed be interested to see the DTD that supports that a heading is part of a quote while still being a document level heading, e.g gets the next heading number assigned if that level is numbered. The example above really looks to me as if there may have been an external heading that is quoted, but then that would have a fixed number and is not to be marked up as a document-level heading.

The "real world example" seems to me that the blockquote was missued to get a visual effect of indentation for some reason as the text is clearly not a quote, is it?

As to "weird errors are fine" I wouldn't say exactly that (may have, though) :-) but more that life is short and doing error detection to get better error messages for weird input cases is not a very high priority. Bottom line: if LaTeX would change it would not be by allowing that construct but producing a more informative error message.

So it looks like Commonmark variant of Markdown allows for that https://spec.commonmark.org/0.29/#example-199
I guess the simple solution would indeed be to detect this use case and warn that if you want to do that, LaTeX conversion won't work.

so it looks -- the typical case of misusing markup for visual effects in my opinion, just like using not properly nested heading levels to get larger fonts, ec. All works if you stay with a known output model but is getting you arbitrary bad results if you do a conversion in other formats. So may not just be LaTeX that doesn't like it. I think it might be worth pointing out that the suggested examples for commonmark are at best questionable from a structural perspective.

Looks like an actual cause of this particular error is not related to counters or document structure, but is caused by non-positive AFTERSKIP parameter of \startsection.
I'm not sure, but it looks like rewritten '\paragraph*{}` without skips could be used inside block quotes because there's presumably nothing more than visual formatting