markdown_exec ¤
Markdown Exec package.
Utilities to execute code blocks in Markdown files.
Modules:
-
debug
–Debugging utilities.
-
formatters
–This subpackage contains all the formatters.
-
logger
–This module contains logging utilities.
-
mkdocs_plugin
–This module contains an optional plugin for MkDocs.
-
processors
–This module contains a Markdown extension allowing to integrate generated headings into the ToC.
-
rendering
–Markdown extensions and helpers.
Functions:
formatter ¤
formatter(
source: str,
language: str,
css_class: str,
options: dict[str, Any],
md: Markdown,
classes: list[str] | None = None,
id_value: str = "",
attrs: dict[str, Any] | None = None,
**kwargs: Any
) -> str
Execute code and return HTML.
Parameters:
-
source
(str
) –The code to execute.
-
language
(str
) –The code language, like python or bash.
-
css_class
(str
) –The CSS class to add to the HTML element.
-
options
(dict[str, Any]
) –The container for options.
-
attrs
(dict[str, Any] | None
, default:None
) –The container for attrs:
-
md
(Markdown
) –The Markdown instance.
-
classes
(list[str] | None
, default:None
) –Additional CSS classes.
-
id_value
(str
, default:''
) –An optional HTML id.
-
attrs
(dict[str, Any] | None
, default:None
) –Additional attributes
-
**kwargs
(Any
, default:{}
) –Additional arguments passed to SuperFences default formatters.
Returns:
-
str
–HTML contents.
validator ¤
validator(
language: str,
inputs: dict[str, str],
options: dict[str, Any],
attrs: dict[str, Any],
md: Markdown,
) -> bool
Validate code blocks inputs.
Parameters:
-
language
(str
) –The code language, like python or bash.
-
inputs
(dict[str, str]
) –The code block inputs, to be sorted into options and attrs.
-
options
(dict[str, Any]
) –The container for options.
-
attrs
(dict[str, Any]
) –The container for attrs:
-
md
(Markdown
) –The Markdown instance.
Returns:
-
bool
–Success or not.