File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -45,19 +45,20 @@ def define_env(env: macros.MacrosPlugin) -> None:
4545 env .variables ["code_annotation_marker" ] = _CODE_ANNOTATION_MARKER
4646
4747 @env .macro # type: ignore[misc]
48- def glossary (term : str ) -> str :
48+ def glossary (term : str , text : str | None = None ) -> str :
4949 """Create a link to the glossary entry for the given term.
5050
5151 Args:
5252 term: The term to link to.
53+ text: The text to display for the link. Defaults to the term.
5354
5455 Returns:
5556 The Markdown link to the glossary entry for the given term.
5657 """
5758 current_path = pathlib .Path (env .page .file .src_uri )
5859 glossary_path = pathlib .Path ("user-guide/glossary.md" )
5960 link_path = glossary_path .relative_to (current_path .parent )
60- return f"[{ term } ]({ link_path } #{ _slugify (term )} )"
61+ return f"[{ text or term } ]({ link_path } #{ _slugify (term )} )"
6162
6263 # The code below is a temporary workaround to make `mkdocs-macros` work with
6364 # `mkdocstrings` until a proper `mkdocs-macros` *pluglet* is available. See
You can’t perform that action at this time.
0 commit comments