Skip to content

HTML article fallback interprets literal Markdown as links and comment headings #85

Closed

Description

@lanyue-llk

HTML fallback can credit article structure that is absent from the HTML DOM. Literal [Alice](/post/1) inside an <h2> becomes a Markdown permalink, and literal ### Alice inside a paragraph can become a comment-author heading.

Minimal public-scorer reproduction:

from lexbench_webfetch.scoring import score_attempt
from lexbench_webfetch.metrics import task_passed
posts = {
    'version': 2, 'minimum_posts': 2, 'hosts': ['example.test'],
    'entry_path': r'/post/\d+', 'html_record_selector': 'article.post',
    'html_permalink_selector': 'a.permalink', 'html_author_selector': '.author',
    'html_body_selector': '.body', 'allow_empty_outer_with_quotes': True,
    'ignored_labels': [], 'unavailable_notices': [], 'non_author_labels': [],
}
case = {'url': 'https://example.test/feed', 'source_benchmark': {'post_contract': posts}}
html = '<h2>[Alice](/post/1)</h2><p>First post.</p><h2>[Bob](/post/2)</h2><p>Second post.</p>'
metrics = score_attempt(case, html.encode(), ok=True, metadata={'answer_format': 'html'})
assert task_passed(True, metrics)  # Incorrect: the DOM contains no links.

Expected: shield literal Markdown syntax in HTML text nodes while preserving syntax generated from actual anchors/headings. Include a genuine-anchor passing control and literal link/comment-heading rejection controls.

Both the pinned pre-migration package and the current candidate reproduce the false positive through score_attempt and task_passed; genuine anchors pass in both. The inherited fallback is visible in article_text.py and article_posts.py.

Independent historical follow-up to #81, deferred under the maintainer's scope instruction.

Activity

  1. self-assigned this
    on Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions