Parent
#1 — context2html Framework
What to build
Add YAML front matter to component #26 (components/26-ECharts 交互式图表集.md) as the pilot, then build context2html/registry.py that can parse it.
Component metadata format (YAML front matter in the .md file):
---
id: 26
name: ECharts 交互式图表集
dependencies: [echarts.min.js, echarts-gl.min.js]
compat_types: [report, article, doc, tutorial, note]
degrade_to: "05"
requires_3d: false
---
Registry API:
ComponentRegistry.list_components(content_type=None) → list of ComponentInfo (id, name, compat_types)
ComponentRegistry.get_component(id) → Component object (metadata + html + css + js)
ComponentRegistry.resolve_dependencies(component_ids) → deduplicated list of lib file names
Component fields: id, metadata (ComponentMeta), html, css, js.
ComponentMeta fields: name, dependencies, compat_types, degrade_to, requires_3d.
The existing scripts/extract-component.py continues to work unmodified — the code-block extraction logic stays the same; the front matter is parsed alongside it.
Acceptance criteria
Blocked by
Parent
#1 — context2html Framework
What to build
Add YAML front matter to component #26 (
components/26-ECharts 交互式图表集.md) as the pilot, then buildcontext2html/registry.pythat can parse it.Component metadata format (YAML front matter in the
.mdfile):Registry API:
ComponentRegistry.list_components(content_type=None)→ list ofComponentInfo(id, name, compat_types)ComponentRegistry.get_component(id)→Componentobject (metadata + html + css + js)ComponentRegistry.resolve_dependencies(component_ids)→ deduplicated list of lib file namesComponentfields:id,metadata(ComponentMeta),html,css,js.ComponentMetafields:name,dependencies,compat_types,degrade_to,requires_3d.The existing
scripts/extract-component.pycontinues to work unmodified — the code-block extraction logic stays the same; the front matter is parsed alongside it.Acceptance criteria
python -c "from context2html.registry import ComponentRegistry; reg = ComponentRegistry(); c = reg.get_component(26)"returns a Component with correct id, name, and dependenciesreg.list_components(content_type="doc")includes #26reg.resolve_dependencies([26])returns["echarts.min.js", "echarts-gl.min.js"]Blocked by