Plugin API¶
Plugins bundle opinionated handler collections so you can enable MkDocs-specific behavior (Material tabs, cards, callouts) or ship your own HTML post-processors without patching the core engine.
texsmith.plugins exposes a namespace package populated by the MkDocs hook in
docs/hooks/mkdocs_hooks.py. Importing a plugin module registers its handlers
via the standard @renders decorator—no extra registry required.
Loading plugins¶
# ensure plugin handlers are registered
import texsmith.plugins.material # noqa: F401
from texsmith import Document, convert_documents
bundle = convert_documents([Document.from_markdown(Path("intro.md"))])
When running texsmith, use the --enable-extension or MkDocs plugin
configuration to import modules before TeXSmith executes. For example, add the
following to your MkDocs hooks file:
def on_config(config):
import texsmith.plugins.material # registers Material handlers
return config
Authoring your own plugin¶
- Create a module (e.g.,
texsmith.plugins.acme) and import any handlers that@rendersfunctions depend on. - Declare entry points or instruct consumers to
import texsmith.plugins.acmebefore rendering. - Optionally provide a MkDocs plugin/hook so documentation builds load your plugin automatically, mirroring what TeXSmith’s docs do with the Material helpers.
Keep plugin modules small and focused; most behaviour belongs in dedicated
handler modules under texsmith.adapters.handlers.
Reference¶
Compatibility layer exposing plugin integrations to documentation.
TeXSmith consolidated its plugin utilities under
texsmith.adapters.plugins. mkdocstrings still references the historical
texsmith.plugins namespace, so we re-export the maintained modules here to
keep the public import path available.
Optional handlers for MkDocs Material specific constructs.
register ¶
register(renderer: Any) -> None
Register Material-specific exercise and epigraph handlers.
Source code in src/texsmith/adapters/plugins/material.py
162 163 164 165 166 | |
render_epigraph ¶
render_epigraph(
element: Tag, context: RenderContext
) -> None
Render Material epigraph blockquotes using the LATEX epigraph macro.
Source code in src/texsmith/adapters/plugins/material.py
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | |
render_exercise_details ¶
render_exercise_details(
element: Tag, context: RenderContext
) -> None
Render exercise blocks authored using
Source code in src/texsmith/adapters/plugins/material.py
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | |
render_exercise_div ¶
render_exercise_div(
element: Tag, context: RenderContext
) -> None
Render Material exercise admonitions into LATEX callouts.
Source code in src/texsmith/adapters/plugins/material.py
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | |