diff --git a/studio/backend/core/inference/_html_to_md.py b/studio/backend/core/inference/_html_to_md.py index e7de4a5312..92471b9866 100644 --- a/studio/backend/core/inference/_html_to_md.py +++ b/studio/backend/core/inference/_html_to_md.py @@ -7,6 +7,11 @@ Minimal HTML-to-Markdown converter using only the standard library. Replaces the external ``html2text`` (GPL-3.0) dependency with a ~250-line ``html.parser.HTMLParser`` subclass. Covers headings, links, bold/italic, lists, tables, blockquotes, code blocks, and entity decoding. + +``main_content=True`` also applies a readability-style heuristic: scope +conversion to the page's ``
`` (else ``
``) subtree when it +carries substantial text, and strip known boilerplate fragments (skip-links, +error placeholders, session banners, cookie prompts) from the result. """ from __future__ import annotations @@ -27,8 +32,138 @@ _SKIP_TAGS = frozenset( "math", "nav", "footer", + # Never-rendered / form-chrome elements, not page content. + "template", + "dialog", + "button", + "select", + "datalist", } ) +#