Skip to content

[distill-page] Fix large text in list-item extraction - #129

Merged
paulirish merged 1 commit into
paulirish:mainfrom
brendankenny:large-ol
Aug 20, 2026
Merged

paulirish merged 1 commit into
paulirish:mainfrom
brendankenny:large-ol

Conversation

@brendankenny

Copy link
Copy Markdown
Contributor

Right now, if there are list items on a page and the rendered font size is large, distill-page tries to turn the text into headings. So

<ol style="font-size: 26px;">
  <li>Text</li>
</ol>

turns into

1. ## Text

This gets really messed up with e.g. inline <code>, where

<ol style="font-size: 26px;">
  <li>The <code>distill-page</code> skill</li>
</ol>

gets turned into

1. ## The
  ## `
  ## distill-page
  ## `
  ## skill

To fix this, like in insideParagraph, this change makes it so large text in a list item isn't automatically a heading. You can still get headings from explicit heading elements in the list item, though.

To do that, another parser state variable—insideListItem—is added. AFAICT insideParagraph could have been successfully re-used insetad, and that would cut down on parser states, but overloading the state like that seemed hacky. It could also be renamed into some new variable (insideNonAutoHeadingContent), but maybe that's too generalized for what could end up being just two states to handle this.

Also added a test page for it. Kind of slow to start yet another chromium instance, but let me know if that should be done a different way.

(also, also, no idea what's going on with CDP Page.getAnnotatedPageContent on mock-page.html, it keeps overwriting with local paths and failing, but it was doing that before I made these changes too :)

@paulirish paulirish left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lovely thank yoU!

@paulirish
paulirish merged commit b91fbe2 into paulirish:main Aug 20, 2026
1 check passed
@brendankenny
brendankenny deleted the large-ol branch August 20, 2026 21:46
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.

2 participants