Skip to content
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

feat: better html to markdown converter #840

Merged
merged 1 commit into from
Sep 6, 2024
Merged

feat: better html to markdown converter #840

merged 1 commit into from
Sep 6, 2024

Conversation

sigoden
Copy link
Owner

@sigoden sigoden commented Sep 6, 2024

Previously, we used the html2text crate, but now we have switched to html_to_markdown crate.

Here is the reason:

  • html2text::from_read(html, wrap_width) requires a wrap_width, but for RAG, a larger wrap width is better. However, using usize::MAX can cause issues, as it may result in the generated markdown file being excessively large due to html2text automatically inserting spaces for wrap_width.
  • html_to_markdown::convert_html_to_markdown allows us to control how each type of element is converted. For example, ignore <img>, <video> tags.

@sigoden sigoden merged commit 555f4f5 into main Sep 6, 2024
3 checks passed
@sigoden sigoden deleted the feat branch September 6, 2024 00:08
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