fix(report): draw North Indian charts from fences after skipHtml dropped SVG
Longform report pages kept the D1/D9/Moon and varga headings but skipHtml stripped the engine's inline SVG. Emit a jyotish-chart JSON fence beside each SVG and render a diamond chart on the reader without relaxing HTML sanitization. BUG-607. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -9333,3 +9333,19 @@
|
||||
- 相关记录:BUG-043(禁止把后台评分状态渲染成用户需要管理的面板。本处边界不同且不冲突:等待屏是只读的,展示的是用户交付物自身的章节结构,`attemptCount`、原始错误码、lease、job id、payload 一律不出服务端)、BUG-576、BUG-574
|
||||
- 复发自:无
|
||||
- 修复版本:待发布
|
||||
|
||||
## BUG-607 | 长报告页分盘标题下没有图
|
||||
|
||||
- 状态:resolved
|
||||
- 首次发现:2026-09-09
|
||||
- 最近更新:2026-09-09
|
||||
- 影响面:`/reports/<id>` Markdown 阅读页、`personal-report-markdown-view.tsx`、`scripts/report_chart_block.py`、`vedic-chart-svg.tsx`
|
||||
- 用户现象:长报告里 `#### D1 — Rashi Chart(本命盘)`、`#### D9 — Navamsa(婚盘)`、`#### Moon Chart(月亮参考盘)` 以及 Vargas I 下 19 个分盘标题后面全是空白,只有标题没有星盘图。
|
||||
- 触发条件:打开任意一份 2026-09-06 之后生成的个人长报告详情页。
|
||||
- 根因:引擎在 Markdown 里内联了南印度 SVG HTML。09-06 把阅读页改成 `react-markdown` + `skipHtml` 后,内联 HTML 被静默丢弃。`skipHtml` 本身是红线(出生地等用户字符串会进正文),不能靠放开 `rehype-raw` 修。
|
||||
- 修复:引擎在每张 SVG 旁追加 `jyotish-chart` 围栏 JSON;阅读页只认围栏,zod 校验后用北印式菱形组件自绘。导出 `.md` 前剥掉围栏,保留 SVG 给外部阅读器。
|
||||
- 验证:`tests/test_report_chart_block.py` 7 项(22 块围栏 == 22 个 `<svg>`,度数/星座/逆行与 core_chart 一致,且该文件在 `CORE_PYTEST_TARGETS`);`frontend/tests/report-chart-block.test.ts`、`frontend/tests/personal-report-markdown-view.test.tsx`(组件 SVG 有 `role="img"`,不含引擎 `viewBox="0 0 420 480"`,坏块显示「图盘数据无效」且无 `<script`)。全量 `npm test` 2975 tests / 2971 pass / 4 fail,失败 4 条均为 Docker Postgres fixture,与图盘无关。`tsc --noEmit` 0 错;`next build --webpack` 后 `/` 仍为 Static。
|
||||
- 防复发:Markdown 阅读页继续 `skipHtml` / 禁止 `rehype-raw`;图盘文本只来自白名单映射。上述测试锁住围栏块数与渲染通路。
|
||||
- 相关记录:`TASK-report-md-page-20260906.md`、`TASK-report-chart-render-20260909.md`
|
||||
- 复发自:无(09-06 直渲回归,不是旧 BUG 编号复发)
|
||||
- 修复版本:待发布
|
||||
|
||||
Reference in New Issue
Block a user