Skip to content

Relax block distance when multi columns and blocks at the same height #1288

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 17 commits into
base: master
Choose a base branch
from

Conversation

lfoppiano
Copy link
Collaborator

@lfoppiano lfoppiano commented May 11, 2025

There is a piece of code:

if (newBlockCoords.distanceTo(prevBlockCoords) < 15) {

that decided whether blocks around a figure caption (something starting with fig, and tagged as <figure> is "close" enough to it (15px fixed distance) so that consider it or not as part of the figure. Before #1266, certain part of the document were discarded, however now are added as paragraphs.

Now, this works in many cases, but it relies on the fact that the blocks distance is consistent.

in this article, for example, the figure caption blocks are correctly recognized:

Figure 1 is correctly assembled:

image

Figure 2 is not, because the blocks dimensions are too "far" (15.16px > 15px):

image

By looking at few examples, if and ends near the column, it will make the block larger, and therefore, close to the other...

I did relax the rule of the 15px when the two blocks are at the same height, but is not a solution that will cover all cases.

any comment is welcome 😄

@lfoppiano lfoppiano changed the title Bugfix/adjust block distance when multi columns Relax block distance when multi columns and blocks at the same height May 11, 2025
@lfoppiano
Copy link
Collaborator Author

Here a better solution: #683 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant