Skip to content

Treat Markdown raw HTML as opaque to document analysis #263

Description

@1sgtpepper

Problem

SciEqLint analyzes math, references, headings, and anchors inside CommonMark raw HTML
instead of treating raw-HTML token ranges as opaque. At
76955a90e0901835035bb9ff27a0de7463d60938, payloads in each of CommonMark's seven
HTML-block families produce ALG001, REF002, and STR001; inline HTML comments and
tag attributes also create math and reference facts. The same false facts reach
notebook Markdown cells and scieqlint graph.

This affects v0.1.5 (3a4f090ac88c96a7e558ee21783873009c7c581d), v1.0.0
(251f35ba9ef350d2a8d4ff5eb63ea9b68e446b8d), v1.1.0
(3996a6cf508e175bead3f325b3ce4ec637e612d1), main, and the open PR heads
0a2c5bd9a29cd1724f63bf81778d967cf79e264b and
ffbd538aef68abc93f1368c001e4da2086214dbd. The reproduction was run with Python
3.14.6 on Fedora Linux 44, kernel 7.1.4-202.fc44.x86_64.

Reproduction

From a checkout of 76955a90e0901835035bb9ff27a0de7463d60938:

cat > raw-html.md <<'EOF'
<!--
$$
x=x+1
$$
See {eq}`ghost`.
#Bad
-->
EOF

PYTHONPATH=src python -m scieqlint check raw-html.md
status=$?
printf 'exit: %s\n' "$status"

Observed:

raw-html.md:3:1: error ALG001 algebraic identity does not hold
  detail: left - right = -1
raw-html.md:5:10: warning REF002 missing equation reference target: ghost
  detail: reference text: {eq}`ghost`
raw-html.md:6:1: warning STR001 ATX heading marker must be followed by a space
  detail: #Bad
exit: 1

Replacing the comment with representative type-1 through type-7 HTML blocks (<pre>,
<!-- -->, <? ?>, declarations, CDATA, block tags, and complete custom tags) produces
the same three diagnostics.

Expected behavior

Raw HTML block contents, inline comments, and inline tag/attribute ranges should not
produce general math, reference, heading, anchor, or graph facts, so this fixture should
produce no diagnostics and exit 0. Markdown text between inline tags must remain active.
Dedicated scieqlint-disable-next-line and scieqlint-symbol HTML-comment directives
must also remain active through their existing dedicated interpreters.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:graphGraph model, schema, and export.area:referencesLabels, references, duplicate/missing checks.area:scanner-markdownMarkdown and MyST source scanning.bugSomething isn't workingneeds fixtureNeeds example input/output coverage.p2Medium-priority feature issue.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions