10 Commits

Author SHA1 Message Date
ntohidi 511c73c7fd fix(html2text): preserve all attributes on table tags when bypass_tables is enabled (#2007) 2026-06-28 10:24:22 +02:00
hafezparast dba38c7886 fix: broaden mermaid SVG text extraction and prevent nested fences (#1043)
Three improvements over the initial fix:

1. Add SVG text/tspan fallback for sequence, gantt, and git diagrams
   which don't use foreignObject / .nodeLabel spans but instead
   render labels via native SVG <text> elements.

2. Detect when a mermaid SVG is already wrapped in an outer <pre>
   (e.g. deepwiki.com) and replace it with a plain <span> instead
   of a new <pre> block, avoiding invalid nested markdown fences.

3. Add data-language attribute support to CustomHTML2Text so that
   pre[data-language=mermaid] emits a proper ```mermaid fence in
   the markdown output, instead of an unlabelled ``` block.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-25 01:36:52 +08:00
unclecode 697c2b2a58 fix: add newline before opening code fence in html2text (#462)
From PR #462 by @jtanningbed
2026-03-07 07:06:41 +00:00
Nasrin 4f9cc0810b Merge pull request #1764 from PatD42/fix/table-gfm-pipes
Fix: Add leading/trailing pipes to GFM tables (pad_tables=False)
2026-02-25 03:32:54 +01:00
Patrick c70ab31abd fix: add leading/trailing pipes to GFM tables (pad_tables=False)
When pad_tables=False (default), html2text generated table rows without
leading/trailing pipe delimiters, producing non-compliant GFM markdown:

  Before: A | B | C
  After:  | A | B | C |

Changes:
- Add leading pipe on first cell, spaced pipe between cells
- Add trailing pipe at end of each row
- Format separator as | --- | --- | instead of ---|---
- Ensure table starts on its own line (soft_br at <table>)
- Handle <caption> element to prevent inline merge with header row
- All changes guarded by `not self.pad_tables` — pad_tables mode unchanged

Includes 13 unit tests covering GFM compliance and pad_tables regression.

Fixes: #1731
2026-02-17 21:14:36 -05:00
Yurii Chukhlib 2016d669a9 fix: Respect <base> tag for relative link resolution in html2text
Fixes #1680

The HTML2Text class was ignoring the <base> tag, causing relative links
to be resolved against the page URL instead of the base URL specified
in the <base href="..."> attribute.

Added <base> tag handling in both HTML2Text and CustomHTML2Text to update
self.baseurl when the tag is encountered, ensuring proper link resolution
according to HTML standards.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-17 12:16:01 +01:00
Aravind dad592c801 2025 feb alpha 1 (#685)
* spelling change in prompt

* gpt-4o-mini support

* Remove leading Y before here

* prompt spell correction

* (Docs) Fix numbered list end-of-line formatting

Added the missing "two spaces" to add a line break

* fix: access downloads_path through browser_config in _handle_download method - Fixes #585

* crawl

* fix: https://github.com/unclecode/crawl4ai/issues/592

* fix: https://github.com/unclecode/crawl4ai/issues/583

* Docs update: https://github.com/unclecode/crawl4ai/issues/649

* fix: https://github.com/unclecode/crawl4ai/issues/570

* Docs: updated example for content-selection to reflect new changes in yc newsfeed css

* Refactor: Removed old filters and replaced with optimised filters

* fix:Fixed imports as per the new names of filters

* Tests: For deep crawl filters

* Refactor: Remove old scorers and replace with optimised ones: Fix imports forall filters and scorers.

* fix: awaiting on filters that are async in nature eg: content relevance and seo filters

* fix: https://github.com/unclecode/crawl4ai/issues/592

* fix: https://github.com/unclecode/crawl4ai/issues/715

---------

Co-authored-by: DarshanTank <darshan.tank@gnani.ai>
Co-authored-by: Tuhin Mallick <tuhin.mllk@gmail.com>
Co-authored-by: Serhat Soydan <ssoydan@gmail.com>
Co-authored-by: cardit1 <maneesh@cardit.in>
Co-authored-by: Tautik Agrahari <tautikagrahari@gmail.com>
2025-02-19 14:13:17 +08:00
UncleCode 8ec12d7d68 Apply Ruff Corrections 2025-01-13 19:19:58 +08:00
UncleCode e130fd8db9 Implement new async crawler features and stability updates
- Introduced new async crawl strategy with session management.
  - Added BrowserManager for improved browser management.
  - Enhanced documentation, focusing on storage state and usage examples.
  - Improved error handling and logging for sessions.
  - Added JavaScript snippets for customizing navigator properties.
2024-12-10 17:55:29 +08:00
UncleCode 6ec4cb33ca Enhance Markdown generation and external content control
- Integrate customized html2text library for flexible Markdown output
- Add options to exclude external links and images
- Improve content scraping efficiency and error handling
- Update AsyncPlaywrightCrawlerStrategy for faster closing
- Enhance CosineStrategy with generic embedding model loading
2024-10-20 18:56:58 +08:00