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 = MkType(str, default='material')
A Pygments theme to use with dark mode.
light
class-attribute
instance-attribute
¤
light = MkType(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(dict[str, type[Style]]) –A mapping of available Pygments styles.
Source code in src/mkdocs_pygments/_internal/plugin.py
96 97 98 99 | |
css_filename
class-attribute
instance-attribute
¤
css_filename = 'pygments.css'
The name of the CSS file to write.
styles
instance-attribute
¤
A mapping of available Pygments styles.
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
101 102 103 104 105 106 107 108 109 110 111 112 | |
on_post_build
¤
Write the CSS contents to the injected style sheets.
Parameters:
-
(config¤MkDocsConfig) –MkDocs configuration.
Source code in src/mkdocs_pygments/_internal/plugin.py
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | |