Summary
A <chart> is silently dropped when a document is converted to PreTeXt. It produces no figure, no fallback, and no message.
<graph> converts correctly, so this is a missing registry entry rather than a missing capability — the SVG a chart needs is already on the component, in the same prop the graph's converter reads.
Cause
packages/doenetml-to-pretext/src/renderers/renderers.ts:196 registers the graph:
graph: { component: PretextComponent.Graph },
and renderers/pretext-xml/graph.tsx reads node.data.props.prefigureXML and emits it into the output.
There is no chart key. grep -rn chart packages/doenetml-to-pretext/src returns nothing at all. A component with no entry falls to _PassThroughWithTag, which emits an element built from node.attributes — so the chart's prefigureXML prop, which is the entire drawing, is discarded and a bare <chart/> is emitted. No PreTeXt template matches that element, so nothing is produced downstream and nothing is reported.
doenetml-print has no renderer registry of its own — it is a Pyodide wrapper around the PreTeXt and PreFigure compilers — so the gap is entirely in doenetml-to-pretext.
Evidence class: read the code. The registry, the fallback and the graph converter were all read directly; I did not run the converter end to end, because its test harness downloads a browser. Someone fixing this should confirm the emitted output rather than take the described <chart/> on trust.
Fix
A chart entry mirroring the graph's, since <chart> exposes prefigureXML exactly as <graph> does. Probably the same converter component rather than a copy of it.
One trap for whoever does it
The chart's <title> is emitted as PreFigure's <caption> as well as an in-picture label (a decision taken in #1883, so that a title reaches tactile output too). PreTeXt inserts a caption of its own: pretext_core/xsl/extract-prefigure.xsl:71-100 puts a pf:caption carrying the figure number ("Figure 2.3.4") as the first child of pf:diagram and then copies the remaining children. label.py:752-758 is a plain diagram.set_caption, so the last caption in document order wins — and the chart's would overwrite PreTeXt's figure number.
This is inert today: the browser always builds mode: "svg" (renderers/utils/prefigureRuntime.ts:183,263) and PreFigure places a caption only when self.format == 'tactile' (diagram.py:444-462), so nothing reads the caption yet. It stops being inert the moment a chart reaches PreTeXt, which is what this issue asks for.
Acceptance
- A document containing a
<chart> converts to PreTeXt with the chart's drawing present.
- The chart's title does not displace PreTeXt's own figure caption.
- A conversion test covering a chart, alongside the existing graph coverage.
🤖 Generated with Claude Code
Summary
A
<chart>is silently dropped when a document is converted to PreTeXt. It produces no figure, no fallback, and no message.<graph>converts correctly, so this is a missing registry entry rather than a missing capability — the SVG a chart needs is already on the component, in the same prop the graph's converter reads.Cause
packages/doenetml-to-pretext/src/renderers/renderers.ts:196registers the graph:and
renderers/pretext-xml/graph.tsxreadsnode.data.props.prefigureXMLand emits it into the output.There is no
chartkey.grep -rn chart packages/doenetml-to-pretext/srcreturns nothing at all. A component with no entry falls to_PassThroughWithTag, which emits an element built fromnode.attributes— so the chart'sprefigureXMLprop, which is the entire drawing, is discarded and a bare<chart/>is emitted. No PreTeXt template matches that element, so nothing is produced downstream and nothing is reported.doenetml-printhas no renderer registry of its own — it is a Pyodide wrapper around the PreTeXt and PreFigure compilers — so the gap is entirely indoenetml-to-pretext.Evidence class: read the code. The registry, the fallback and the graph converter were all read directly; I did not run the converter end to end, because its test harness downloads a browser. Someone fixing this should confirm the emitted output rather than take the described
<chart/>on trust.Fix
A
chartentry mirroring the graph's, since<chart>exposesprefigureXMLexactly as<graph>does. Probably the same converter component rather than a copy of it.One trap for whoever does it
The chart's
<title>is emitted as PreFigure's<caption>as well as an in-picture label (a decision taken in #1883, so that a title reaches tactile output too). PreTeXt inserts a caption of its own:pretext_core/xsl/extract-prefigure.xsl:71-100puts apf:captioncarrying the figure number ("Figure 2.3.4") as the first child ofpf:diagramand then copies the remaining children.label.py:752-758is a plaindiagram.set_caption, so the last caption in document order wins — and the chart's would overwrite PreTeXt's figure number.This is inert today: the browser always builds
mode: "svg"(renderers/utils/prefigureRuntime.ts:183,263) and PreFigure places a caption only whenself.format == 'tactile'(diagram.py:444-462), so nothing reads the caption yet. It stops being inert the moment a chart reaches PreTeXt, which is what this issue asks for.Acceptance
<chart>converts to PreTeXt with the chart's drawing present.🤖 Generated with Claude Code