Open ahus1 opened 4 years ago
As the last paragraph didn't fit on the page any more, it was "overflowing". Looking at the resulting PDF it disappeared (!) from the page. That is: the complete last paragraph.
The warning "overflow on page" can also be seen when converting examples/document/document.adoc
but the content is preserved.
$ ./bin/asciidoctor-pdf examples/document/document.adoc
overflow on page-4 JSHandle@object
As you can see, the list is overflowing to page 5:
+*+ Asciidoctor also supports the Markdown syntax for this language feature.
You can see that AsciiDoc has the following advantages over Markdown:
* AsciiDoc uses the same number of markup characters or less when compared to Markdown in nearly all cases.
* AsciiDoc uses a consistent formatting scheme (i.e., it has consistent patterns).
* AsciiDoc can handle all permutations of nested inline (and block) formatting, whereas Markdown often falls down.
* AsciiDoc handles cases that Markdown doesn't, such as a proper approach to inner-word markup, source code blocks and block-level images.
NOTE: Certain Markdown flavors support additional features, such as tables and definition lists.
However, since these features don't appear in plain Markdown, they are not included in the comparison table.
Asciidoctor, which is used for converting AsciiDoc on GitHub and GitLab, emulates "`the good parts`" of the Markdown syntax, like headings, blockquotes and fenced code blocks, making migration from Markdown to AsciiDoc fairly simple.
In this case, syntax highlighter is not enabled.
There are probably different kinds of overflows: While layouting a page, and after layouting a page.
I added some debug statements locally to pagedjs
console.warn("overflow on", page.id, overflowToken);
// Only reflow while rendering
if (this.rendered) {
return;
}
Apparently the "good" overflows occur when rendered is false, and the "bad" overflows occur when rendered is true. No good way to hook in there AFAIK.
Then testing the conversion of the "AsciiDoc Writer's guide" I had a situation when syntax highlighting on code snippets with highlightjs occurred after pagedjs already rendered the pages. The warning "overflow on page" indicated something suspicious.
After some analysis it turned out that the late changes to the CSS after pagedjs layout changed the height of the contents of the page and trigged pagedjs' addResizeObserver. As the last paragraph didn't fit on the page any more, it was "overflowing". Looking at the resulting PDF it disappeared (!) from the page. That is: the complete last paragraph.
Expected behaviour: As this would leave the user with document that is missing content, rendering of the PDF shouldn't continue. Instead there should be an error.
I'll post a fix to remedy the situation with highlightjs. But This issue should be closed after this is no longer a warning, but an error that aborts creating the PDF.