Skip to content

Commit

Permalink
feat: Abort with error when the plugin is configured to require the A…
Browse files Browse the repository at this point in the history
…NSI extra but it is not installed
  • Loading branch information
pawamoy committed Jun 13, 2024
1 parent 6b845e8 commit 25bcbbe
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/markdown_exec/mkdocs_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ def on_config(self, config: MkDocsConfig) -> MkDocsConfig | None:
if "pymdownx.superfences" not in config["markdown_extensions"]:
message = "The 'markdown-exec' plugin requires the 'pymdownx.superfences' Markdown extension to work."
raise PluginError(message)
if self.config.ansi in ("required", True) and not ansi_ok:
raise PluginError(
"The configuration for the 'markdown-exec' plugin requires "
"that it is installed with the 'ansi' extra. "
"Install it with 'pip install markdown-exec[ansi]'.",
)
self.mkdocs_config_dir = os.getenv("MKDOCS_CONFIG_DIR")
os.environ["MKDOCS_CONFIG_DIR"] = os.path.dirname(config["config_file_path"])
self.languages = self.config.languages
Expand Down

0 comments on commit 25bcbbe

Please sign in to comment.