2.4 KiB
mkdocs-schematic-footprint-viewer
A Zensical/Python-Markdown extension that renders an interactive schematic and footprint viewer in Markdown.
Use this shortcode anywhere in Markdown and pass the JSON file at the call site:
{% schematic-footprint json="files/VL53L0X/VL53L0X_merged.json" %}
Installation
pip install mkdocs-schematic-footprint-viewer
For local development:
pip install -e ".[test]"
Zensical Configuration
Zensical's public plugin/module API is still evolving, so this package integrates through the stable Python-Markdown extension path that Zensical supports.
Add the extension to zensical.toml:
[project.markdown_extensions.schematic_footprint_viewer]
default_json = "merged.json"
Then use the shortcode in Markdown:
{% schematic-footprint json="files/VL53L0X/VL53L0X_merged.json" %}
Run Zensical:
zensical serve
or:
zensical build
Shortcode Options
The JSON path belongs in the Markdown shortcode:
{% schematic-footprint json="merged.json" %}
src is also accepted as an alias:
{% schematic-footprint src="files/MP1584/MP1584_merged.json" %}
You can override the box dimensions per shortcode:
{% schematic-footprint json="merged.json" width="24rem" height="20rem" %}
Zensical Configuration With Options
These settings define defaults for every viewer:
[project.markdown_extensions.schematic_footprint_viewer]
default_json = "merged.json"
width = "15rem"
height = "13rem"
konva_url = "https://unpkg.com/konva@9/konva.min.js"
If you keep konva.min.js locally in your built site, point konva_url to that file:
[project.markdown_extensions.schematic_footprint_viewer]
konva_url = "konva.min.js"
If your zensical.toml already has plugins, keep them separate. For example:
[project]
plugins = [
{ search = {} },
{ badges = {} },
{ document-dates = { position = "top", type = "timeago", exclude = [
"index.md",
"blog/*",
] } },
]
[project.markdown_extensions.schematic_footprint_viewer]
default_json = "merged.json"
width = "15rem"
height = "13rem"
Do not add this package to plugins in zensical.toml; use markdown_extensions as shown above.
Output
The shortcode is replaced during Markdown rendering with a scoped viewer containing two Konva canvases: one for PCB/footprint data and one for schematic data. The viewer fetches the JSON path passed in Markdown.