Repository navigation
fix(html2md): retain complex tables and referenced fragments - #1336
lanyue-llk wants to merge 3 commits into
Conversation
Spider Bench A/B✅ All benchmark browser service runs completed; results are informational. Public HEAD: 189 / 240 rows; 39 / 48 sites produced rows; 9 unexpected empty sites. ✅ Deterministic fixture contract is clean. Common ancestor Public 48-site run · informational
Public-site content, timing, and memory are noisy. This single A/B run reports evidence only; site outcome counts explain missing rows without treating them as a deterministic regression. CPU and memory timelinesThese are bounded 40-point views of the same complete process-tree samples used by the HTML report. CPU uses 100% per occupied logical core; memory lines are RSS first and PSS second when complete PSS samples are available. Basexychart-beta
title "Base CPU"
x-axis "Elapsed seconds" [1.037, 1.537, 2.539, 3.54, 4.041, 4.542, 5.042, 6.545, 7.546, 9.049, 10.05, 11.552, 13.052, 14.054, 15.555, 16.556, 18.058, 19.059, 20.562, 21.563, 23.065, 24.568, 25.569, 27.071, 28.073, 29.574, 30.575, 32.077, 33.078, 34.58, 36.083, 37.083, 38.585, 39.587, 41.089, 42.09, 43.594, 44.595]
y-axis "CPU percent" 0 --> 500
line [0, 41.98, 141.77, 163.84, 23.95, 75.81, 129.86, 195.86, 153.78, 133.62, 125.82, 141.79, 85.96, 123.88, 49.94, 87.9, 69.94, 49.96, 113.71, 107.87, 141.87, 111.86, 107.77, 145.84, 117.82, 129.84, 181.78, 67.91, 97.84, 37.96, 139.81, 80.01, 7.99, 15.98, 97.86, 109.83, 53.9, 137.78]
xychart-beta
title "Base memory: RSS then PSS"
x-axis "Elapsed seconds" [0.036, 1.037, 1.537, 2.539, 3.54, 4.041, 4.542, 5.042, 6.545, 7.546, 9.049, 10.05, 11.552, 13.052, 14.054, 15.555, 16.556, 18.058, 19.059, 20.562, 21.563, 23.065, 24.568, 25.569, 27.071, 28.073, 29.574, 30.575, 32.077, 33.078, 34.58, 36.083, 37.083, 38.585, 39.587, 41.089, 42.09, 43.594, 44.595, 45.928]
y-axis "Memory MiB" 0 --> 500
line [12.32, 54.82, 91.12, 139.43, 131.66, 131.79, 117.38, 134.92, 149.55, 181.32, 166.42, 186.55, 151.64, 182.89, 187.97, 170.78, 162.13, 162.2, 145.5, 184.18, 196.32, 164.78, 305.21, 203.31, 147.51, 138.91, 202.23, 168.68, 154.14, 160.18, 148.68, 201.75, 178.75, 148.69, 147.8, 164.77, 174.95, 150.77, 172.9, 0]
line [9.16, 51.21, 87.55, 135.84, 128.37, 128.22, 113.85, 131.35, 146.14, 177.64, 162.43, 183.26, 148.16, 178.87, 184.37, 167.28, 158.63, 158.61, 141.78, 180.79, 192.96, 161.08, 302.46, 199.68, 143.98, 135.29, 198.85, 165.05, 150.34, 156.41, 145.04, 197.98, 174.92, 144.99, 144.1, 160.87, 171.25, 147.31, 169.32, 0]
HEADxychart-beta
title "HEAD CPU"
x-axis "Elapsed seconds" [1.037, 1.538, 2.539, 4.04, 5.543, 6.544, 8.046, 9.047, 9.548, 11.049, 12.051, 13.553, 15.056, 16.058, 17.561, 19.063, 20.064, 21.565, 23.067, 24.569, 25.57, 27.071, 27.572, 28.573, 29.575, 31.076, 32.578, 33.578, 35.08, 36.582, 37.583, 39.086, 40.586, 42.086, 43.086, 44.588, 46.091, 47.093]
y-axis "CPU percent" 0 --> 500
line [6, 115.74, 118, 110.01, 147.76, 161.91, 69.89, 193.72, 153.82, 141.89, 177.65, 141.64, 25.96, 0, 5.98, 105.92, 131.83, 55.93, 129.85, 135.77, 109.85, 99.86, 115.86, 99.95, 111.89, 113.87, 171.93, 147.97, 105.86, 105.85, 17.98, 117.69, 84.07, 8, 68, 117.95, 127.77, 119.76]
xychart-beta
title "HEAD memory: RSS then PSS"
x-axis "Elapsed seconds" [0.037, 1.037, 1.538, 2.539, 4.04, 5.543, 6.544, 8.046, 9.047, 9.548, 11.049, 12.051, 13.553, 15.056, 16.058, 17.561, 19.063, 20.064, 21.565, 23.067, 24.569, 25.57, 27.071, 27.572, 28.573, 29.575, 31.076, 32.578, 33.578, 35.08, 36.582, 37.583, 39.086, 40.586, 42.086, 43.086, 44.588, 46.091, 47.093, 48.349]
y-axis "Memory MiB" 0 --> 500
line [12.32, 63.98, 110.93, 127.37, 140.24, 166.98, 175.62, 190.64, 185.97, 173.47, 185.2, 185.14, 161.71, 149.64, 146.86, 147.68, 165.72, 172.92, 149.62, 157.93, 196.68, 176.81, 270.14, 276.3, 211.57, 233.25, 155.63, 202.76, 170.07, 157.17, 153.41, 155.16, 232.31, 271.44, 169.23, 181.21, 195.05, 162.99, 178.66, 0]
line [9.24, 60.54, 107.5, 124.17, 136.84, 163.63, 172.25, 187.23, 183.09, 170.06, 181.76, 181.72, 158.72, 146.35, 143.43, 144.25, 162.4, 169.49, 145.4, 154.57, 193.31, 173.12, 266.77, 272.43, 208.11, 229.68, 152.25, 199.32, 166.55, 153.64, 149.88, 151.65, 228.86, 267.94, 165.71, 177.7, 191.52, 159.07, 175.22, 0]
Deterministic fixture · required contractThe fixture exercises 15 routes: 8 are expected to emit rows and 7 intentionally exercise empty, loading, or timeout behavior.
Full HTML, JSON, CSV, logs, and page snapshots: workflow run and full The public-web A/B is informational. The exact HEAD fixture contract runs as a separate required CI check; timing and public-site content deltas remain non-blocking. |
CI Regression ReportSource CI run · source state at render:
Release regression — ✅ HEAD/base failures 0/0; raw binary +0.019646%Package and image size
Startup latency and PSS
Concurrency matrix
Frontend differential — ✅ 1,020/1,020 cases matched; 0 issues
Agent episodes · Moli vs Chromium — ✅ 8/8 Moli episodes passed; 0 failures
Runtime and CDP session contracts — ✅ 26 contract cases; 0 failures
CDP smoke — ✅ 52/52 groups passed; 621 scenariosWorkers: 4 · cumulative group time: 162.66 s · failed groups: 0
WebMainBench · 545 pages — ✅ 545/545 completed; 0 unexpected failures
Frozen HTML · Linux · Diagnostics: All artifact fields are parsed by the trusted default-branch renderer; missing or invalid inputs remain visible as unavailable. |
fd2db36 to
6ed184d
Compare
Sequential Navigation Soak A/B✅ HEAD completed the 200-navigation resilience and memory observation. One browser process, one target, and one CDP session navigate CSDN → SegmentFault → Huaban → example.com repeatedly. This run issued 200 Common ancestor Session resilience
A public-page failure is reported separately from an unrecoverable session. The soak requires all navigation attempts, zero failed recovery, zero lifecycle/network ordering violations, and complete resource evidence. Process-tree memory
HEAD memory by 50-navigation quarter
Raw reports and per-navigation boundary samples: workflow run and full Public-site timing and memory are observational. Use the A/B deltas and trend shape as evidence, not as a deterministic performance threshold. |
6ed184d to
22760a4
Compare
13a8b62 to
da9b680
Compare
ba33592 to
a863725
Compare
a863725 to
eb8ccd8
Compare
eb8ccd8 to
59c3c4d
Compare
|
Closing after the consolidation audit. This belongs to an earlier experimental Markdown stack and was not part of the measured fixed build. Current failure evidence does not justify carrying its broad table and fragment expansion into #1501, so it is intentionally not merged. |
问题与方案
Markdown 管道表格无法表达跨行、跨列和嵌套表格。原转换把这些结构展开成文字,丢失单元格之间的归属关系。文内链接也可能保留
#fragment却丢掉目标;代码中的链接和特殊标题会出现类似损失。简单表格继续使用 Markdown;复杂表格保留经过筛选的内容 HTML,保留行列、标题、合并单元格和嵌套关系。HTML 路径复用媒体、表单与公式转换,文字保持转义。仅保留实际被引用的片段目标,并遵循 ID 优先和精确匹配后再解码的规则。代码内的链接及被引用目标使用 HTML 保留语义。
根因、方案与验收
name当锚点<a name>,精确匹配优先于解码,ID 优先name的反向控制、代码与 MathML 内的目标修复机制图
查看原图
flowchart LR A[表格结构] --> B{管道表格能完整表示?} B -->|能| C[Markdown 表格] B -->|不能| D[内容 HTML 表格] E[媒体、表单与公式规则] --> D F[文内链接] --> G[匹配实际目标并保留锚点] G --> D G --> C范围与依赖
这是 #919 的表格与片段链接部分,直接基于 #1335;#1335 已包含 #1334 的媒体与表单规则。复杂表格复用两组转换,本 PR 的 diff 只包含表格与片段增量。DOM 接口增加默认的布局边界查询,#1337 的运行时适配提供真实 CSS 状态。
验证
cargo fmt --allcargo test -p moli-html2md --locked:全部通过。cargo clippy -p moli-html2md --all-targets --locked -- -D warnings:通过。测试覆盖合并及嵌套表格、媒体与控件在两种表格路径中的一致性、片段编码及目标优先级、代码内链接、嵌套标题、深层结构的小线程栈与复制量边界。已有测试保留原排列,减少无关 diff。完整仓库测试交由 CI。
与 #1305 的关系
#1305 直接基于 main,负责执行调用者明确指定的脚本,等待 Promise 和导航后走标准导出路径。这四组修复负责导出内容的完整性与语义。双方没有代码前置依赖;组合后,交互后的 DOM 会使用这些共享转换规则。
默认只读采集和明确交互采集是不同的测量协议。报告中的历史成绩仍绑定原调用协议;不能给单一方法补交互后替换同一行成绩。
报告
完整 WebMainBench 报告 保留 #919 已发布的运行。其源码为
721bd2e329f96c06573db6e6b257a149cf17a6fe,该测量不对应本拆分分支。PR stack
GitHub 原生依赖链:#1334 → #1335 → #1336 → #1337 → #1380 → #1428 → #1431 → #1432。
每个 PR 的 GitHub base 都是左侧紧邻分支,因此 Files changed 只显示本层增量。按从左到右的顺序合入。#919 是保留的历史完整组合,不是这条链的依赖;#1429 独立面向
main,只提供通用 CI 评测入口。