115 lines
2.4 KiB
Markdown
115 lines
2.4 KiB
Markdown
# 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:
|
|
|
|
```md
|
|
{% schematic-footprint json="files/VL53L0X/VL53L0X_merged.json" %}
|
|
```
|
|
|
|
## Installation
|
|
|
|
```bash
|
|
pip install mkdocs-schematic-footprint-viewer
|
|
```
|
|
|
|
For local development:
|
|
|
|
```bash
|
|
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`:
|
|
|
|
```toml
|
|
[project.markdown_extensions.schematic_footprint_viewer]
|
|
default_json = "merged.json"
|
|
```
|
|
|
|
Then use the shortcode in Markdown:
|
|
|
|
```md
|
|
{% schematic-footprint json="files/VL53L0X/VL53L0X_merged.json" %}
|
|
```
|
|
|
|
Run Zensical:
|
|
|
|
```bash
|
|
zensical serve
|
|
```
|
|
|
|
or:
|
|
|
|
```bash
|
|
zensical build
|
|
```
|
|
|
|
## Shortcode Options
|
|
|
|
The JSON path belongs in the Markdown shortcode:
|
|
|
|
```md
|
|
{% schematic-footprint json="merged.json" %}
|
|
```
|
|
|
|
`src` is also accepted as an alias:
|
|
|
|
```md
|
|
{% schematic-footprint src="files/MP1584/MP1584_merged.json" %}
|
|
```
|
|
|
|
You can override the box dimensions per shortcode:
|
|
|
|
```md
|
|
{% schematic-footprint json="merged.json" width="24rem" height="20rem" %}
|
|
```
|
|
|
|
## Zensical Configuration With Options
|
|
|
|
These settings define defaults for every viewer:
|
|
|
|
```toml
|
|
[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:
|
|
|
|
```toml
|
|
[project.markdown_extensions.schematic_footprint_viewer]
|
|
konva_url = "konva.min.js"
|
|
```
|
|
|
|
If your `zensical.toml` already has plugins, keep them separate. For example:
|
|
|
|
```toml
|
|
[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.
|