-
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Support custom templates through objects' extra data
- Loading branch information
Showing
5 changed files
with
47 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Extensions | ||
|
||
## :warning: Work in Progress! | ||
|
||
The Python handler supports extensions through | ||
[*mkdocstrings*' handler extensions](https://mkdocstrings.github.io/usage/handlers/#handler-extensions). | ||
|
||
Specifically, additional templates can be added to the handler, | ||
and Griffe extensions can instruct the handler to use a particular template | ||
for a particular object by setting a value in the Griffe object's `extra` dictionary: | ||
|
||
```python title="griffe_extension.py" | ||
obj = ... # get a reference to a Griffe object | ||
if "mkdocstrings" not in obj.extra: | ||
obj.extra["mkdocstrings"] = {} | ||
obj.extra["mkdocstrings"]["template"] = "template_name.html" | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters