Coverage for app / documents / visuals / kinds.py: 100%
7 statements
« prev ^ index » next coverage.py v7.13.4, created at 2026-10-31 11:23 +0000
« prev ^ index » next coverage.py v7.13.4, created at 2026-10-31 11:23 +0000
1"""The visual fence kinds: one per render tool (``registry.RENDER_FENCE_LANGUAGES``
2holds the tools, ``tests/documents/visuals`` pins the two together)."""
4from __future__ import annotations
6from typing import Literal, get_args
8VisualKind = Literal["chart", "plot", "mermaid", "graph", "map"]
9VISUAL_KINDS: tuple[str, ...] = get_args(VisualKind)
12def kind_of(info: str | None) -> str | None:
13 """The visual kind a fence's info string names, or None: its first word,
14 exactly and in lower case, as fe-core's ``language-<kind>`` reads it."""
15 word = (info or "").strip().split(maxsplit=1)
16 return word[0] if word and word[0] in VISUAL_KINDS else None