mkdocs_pygments ¤
MkDocs Pygments package.
Highlighting themes for code blocks.
Classes:
-
PygmentsConfig–Configuration options for the plugin.
-
PygmentsPlugin–The MkDocs plugin to inject Pygments style sheets.
PygmentsConfig ¤
Bases: Config
Configuration options for the plugin.
Attributes:
-
dark–A Pygments theme to use with dark mode.
-
light–A Pygments theme to use with light mode.
-
respect_dark_background–Whether to respect the background color of the dark theme.
-
respect_light_background–Whether to respect the background color of the light theme.
dark class-attribute instance-attribute ¤
dark = Type(str, default='material')
A Pygments theme to use with dark mode.
light class-attribute instance-attribute ¤
light = Type(str, default='material')
A Pygments theme to use with light mode.
PygmentsPlugin ¤
PygmentsPlugin()
Bases: BasePlugin[PygmentsConfig]
The MkDocs plugin to inject Pygments style sheets.
Methods:
-
on_config–Inject dark and light style sheets in
extra_css. -
on_post_build–Write the CSS contents to the injected style sheets.
Attributes:
-
css_filename–The name of the CSS file to write.
-
styles–A mapping of available Pygments styles.
Source code in src/mkdocs_pygments/_internal/plugin.py
78 79 80 81 | |
css_filename class-attribute instance-attribute ¤
css_filename = 'pygments.css'
The name of the CSS file to write.
on_config ¤
on_config(config: MkDocsConfig) -> MkDocsConfig | None
Inject dark and light style sheets in extra_css.
Parameters:
-
config(MkDocsConfig) –The MkDocs config object.
Returns:
-
MkDocsConfig | None–The config.
Source code in src/mkdocs_pygments/_internal/plugin.py
83 84 85 86 87 88 89 90 91 92 93 94 | |
on_post_build ¤
on_post_build(config: MkDocsConfig, **kwargs: Any) -> None
Write the CSS contents to the injected style sheets.
Parameters:
-
config(MkDocsConfig) –MkDocs configuration.
Source code in src/mkdocs_pygments/_internal/plugin.py
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | |