[PR #5742] [MERGED] Turn HTML scraped sites to Markdown for better research #5551

Closed
opened 2026-06-05 15:21:43 -04:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Mintplex-Labs/anything-llm/pull/5742
Author: @timothycarambat
Created: 6/1/2026
Status: Merged
Merged: 6/2/2026
Merged by: @timothycarambat

Base: masterHead: html-to-markdown-scraper


📝 Commits (3)

  • b6c43c2 Turn HTML scraped sites to Markdown for better research
  • 0946dec pin
  • e62c180 Merge branch 'master' into html-to-markdown-scraper

📊 Changes

4 files changed (+223 additions, -7 deletions)

View changed files

📝 collector/package.json (+1 -0)
📝 collector/processLink/convert/generic.js (+7 -7)
collector/processLink/helpers/htmlToMarkdown.js (+203 -0)
📝 collector/yarn.lock (+12 -0)

📄 Description

Pull Request Type

  • feat (New feature)
  • 🐛 fix (Bug fix)
  • ♻️ refactor (Code refactoring without changing behavior)
  • 💄 style (UI style changes)
  • 🔨 chore (Build, CI, maintenance)
  • 📝 docs (Documentation updates)

Relevant Issues

closes #5548
connect #5620

Description

  • Switches the web scraper from using innerText to innerHTML and converts the HTML to markdown using node-html-markdown

  • Solves issues with LLMs hallucinating links because the current way this works is we strip all links from the page and only would keep text

  • This PR now allows us to have links and tables in markdown format giving LLMs much better context when doing things like deep research or chained agent actions to navigate to other links

While doing this does normally add more tokens to the context, the data it provides is so much more impactful to the output quality that we determine it is well worth it.

Additional Information

Examples:

Site innerText (original) node-html-markdown turndown (now)
anythingllm.com 879 840 (-4.4%) 839 (-4.6%)
Wikipedia AI 23,471 58,348 (+148.6%) 18,264 (-22.2%)
GitHub repo 1,116 8,894 (+697.0%) 2,248 (+101.4%)

Developer Validations

  • I ran yarn lint from the root of the repo & committed changes
  • Relevant documentation has been updated (if applicable)
  • I have tested my code functionality
  • Docker build succeeds locally

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Mintplex-Labs/anything-llm/pull/5742 **Author:** [@timothycarambat](https://github.com/timothycarambat) **Created:** 6/1/2026 **Status:** ✅ Merged **Merged:** 6/2/2026 **Merged by:** [@timothycarambat](https://github.com/timothycarambat) **Base:** `master` ← **Head:** `html-to-markdown-scraper` --- ### 📝 Commits (3) - [`b6c43c2`](https://github.com/Mintplex-Labs/anything-llm/commit/b6c43c2c2eaccb710c5691d1c8ec37cb9076d204) Turn HTML scraped sites to Markdown for better research - [`0946dec`](https://github.com/Mintplex-Labs/anything-llm/commit/0946dec78538ddce0fc7597e031cb7af40464432) pin - [`e62c180`](https://github.com/Mintplex-Labs/anything-llm/commit/e62c180c93ddc22ae8cf46345c34d50255e29913) Merge branch 'master' into html-to-markdown-scraper ### 📊 Changes **4 files changed** (+223 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `collector/package.json` (+1 -0) 📝 `collector/processLink/convert/generic.js` (+7 -7) ➕ `collector/processLink/helpers/htmlToMarkdown.js` (+203 -0) 📝 `collector/yarn.lock` (+12 -0) </details> ### 📄 Description ### Pull Request Type <!-- For change type, change [ ] to [x]. --> - [ ] ✨ feat (New feature) - [ ] 🐛 fix (Bug fix) - [ ] ♻️ refactor (Code refactoring without changing behavior) - [ ] 💄 style (UI style changes) - [ ] 🔨 chore (Build, CI, maintenance) - [ ] 📝 docs (Documentation updates) ### Relevant Issues <!-- Use "resolves #xxx" to auto resolve on merge. Otherwise, please use "connect #xxx" --> closes #5548 connect #5620 ### Description - Switches the web scraper from using innerText to innerHTML and converts the HTML to markdown using node-html-markdown - Solves issues with LLMs hallucinating links because the current way this works is we strip all links from the page and only would keep text - This PR now allows us to have links and tables in markdown format giving LLMs much better context when doing things like deep research or chained agent actions to navigate to other links While doing this does normally *add more tokens* to the context, the data it provides is so much more impactful to the output quality that we determine it is well worth it. ### Additional Information Examples: | Site | innerText (original) | node-html-markdown | turndown (now) | |------|---------------------|-------------------|----------------| | anythingllm.com | 879 | 840 (-4.4%) | **839 (-4.6%)** | | Wikipedia AI | 23,471 | 58,348 (+148.6%) | **18,264 (-22.2%)** | | GitHub repo | 1,116 | 8,894 (+697.0%) | **2,248 (+101.4%)** | <!-- Add any other context about the Pull Request here that was not captured above. --> ### Developer Validations <!-- All of the applicable items should be checked. --> - [ ] I ran `yarn lint` from the root of the repo & committed changes - [ ] Relevant documentation has been updated (if applicable) - [ ] I have tested my code functionality - [ ] Docker build succeeds locally --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-06-05 15:21:43 -04:00
yindo closed this issue 2026-06-05 15:21:43 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mintplex-Labs/anything-llm#5551