Repository navigation
[distill-page] Fix large text in list-item extraction - #129
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Right now, if there are list items on a page and the rendered font size is large,
distill-pagetries to turn the text into headings. Soturns into
1. ## TextThis gets really messed up with e.g. inline
<code>, wheregets turned into
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. AFAICTinsideParagraphcould 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 :)