Skip to content

[Parsing] Same-row headings above side-by-side tables are merged #418

Description

@Chengyunlai

Description

Two independent headings placed on the same y coordinate above two
side-by-side ruled tables can be emitted as one wrapped Markdown heading.

This is the remaining downstream boundary after the geometry and projected
table-line fixes in #392. At the tested head of #392, the two tables are
correctly independent, but their headings are still merged.

Document

The PDF is self-authored and synthetic. It contains no customer, personal, or
project data. Each table has a nearby heading and exactly three rows by two
columns.

Expected output

## Release schedule

| Channel | Status |
|---|---|
| Stable | Ready |
| Preview | Testing |

## Support hours

| Region | Window |
|---|---|
| East | Morning |
| West | Afternoon |

Actual output

At Chengyunlai/liteparse@26b79a6, the tables are separate but the headings
are merged:

## Release schedule Support hours

| Channel | Status |
|---|---|
| Stable | Ready |
| Preview | Testing |

| Region | Window |
|---|---|
| East | Morning |
| West | Afternoon |

Command used

lit parse side-by-side-three-row-tables.pdf \
  --no-ocr \
  --format markdown \
  --output output.md \
  --quiet

A/B evidence

The same PDF and public command were run in the same Linux container:

Version Grid geometry Markdown tables Headings
main@2fd644a one merged component one merged table merged
PR #392 before projection fix, 9d740a4 two components ruled candidates rejected merged
PR #392 with projection fix, 26b79a6 two components two independent tables still merged

This shows that table-confidence thresholds and fallback are no longer the
remaining problem at 26b79a6.

Root-cause evidence

The projection stage already emits two distinct same-y lines:

[md] ... text="Release schedule"
[MD heading-emit size/outline] h2 ... 'Release schedule'
[md] ... text="Support hours"

Markdown classification then treats Support hours as a wrapped continuation
of Release schedule. continues_heading sees the same font size, bold style,
and region path, while the equal y coordinate produces a negative vertical
gap. It currently has no horizontal or independent-table ownership guard.

Scope and regression constraints

The fix should preserve legitimate wrapped multi-line headings. It should not:

  • globally disable heading continuation;
  • change ruled-table confidence thresholds;
  • change fallback table detection.

Suggested regression coverage:

  • same-y headings owned by separate side-by-side tables remain separate;
  • a legitimate two-line wrapped heading still merges;
  • one page-spanning heading above both tables remains one heading;
  • ordinary non-table headings keep current behavior.

Environment

Related: #392, #414

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions