The lint_svg tool statically analyzes SVG overlays containing Stencila (s:*) custom elements for layout, reference, and attribute errors. It catches issues before rendering, removing visual guesswork from the overlay authoring process.
Use lint_svg after authoring or modifying an SVG overlay to check for problems like overlapping labels, dangling anchor references, components outside the viewBox, and invalid attributes.
The linter checks three categories of rules:
Bounding boxes for labels are estimated using character-count heuristics (the same multipliers the compiler uses for layout). Structural elements like lines and arcs do not check against each other -- only label-vs-label and label-vs-line collisions are flagged.
Components excluded from collision checks: spotlight, halo (these are overlays by design).
To suppress collision warnings for a specific component, place an XML comment immediately before it:
<!-- lint-ignore collision -->
<s:badge x="100" y="50" label="Intentionally overlapping"/>
This suppresses both text/text and text/line collision warnings for that element.
Returns a JSON object with:
{
"status": "issues_found",
"count": 2,
"messages": [
{
"level": "Error",
"message": "<s:callout> references anchor '#peak' which does not exist"
},
{
"level": "Warning",
"message": "Label collision: <s:badge> and <s:badge> labels overlap"
}
]
}