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:
Jesse_Chen
2026-09-09 15:11:00 +08:00
co-authored by Cursor
parent d5972ef44a
commit 2fdcb14fd6
23 changed files with 2628 additions and 124 deletions
@@ -4,13 +4,13 @@ import { Check, Copy } from "lucide-react";
import { isValidElement, useEffect, useRef, useState, type ReactNode } from "react";
/** The fenced language, from the `language-xxx` class react-markdown puts on <code>. */
function fencedLanguage(node: ReactNode): string {
export function fencedLanguage(node: ReactNode): string {
if (!isValidElement<{ className?: string }>(node)) return "";
return /language-([\w+-]+)/.exec(node.props.className ?? "")?.[1] ?? "";
}
/** The raw source inside the fence, for the copy button. */
function fencedSource(node: ReactNode): string {
export function fencedSource(node: ReactNode): string {
if (typeof node === "string") return node;
if (Array.isArray(node)) return node.map(fencedSource).join("");
if (isValidElement<{ children?: ReactNode }>(node)) return fencedSource(node.props.children);