Skip to content

Commit

Permalink
Allow inlining only SVG for now
Browse files Browse the repository at this point in the history
  • Loading branch information
LukeCarrier committed Apr 20, 2024
1 parent 9f1d9b3 commit 5f80955
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions mkdocs_drawio_exporter/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,17 @@ def prepare_drawio_executable(self, executable, executable_names, platform_execu
raise ConfigurationError.drawio_executable(
None, 'Unable to find Draw.io executable; ensure it\'s on PATH or set drawio_executable option')

def validate_config(self, config: Configuration):
"""Validate the configuration.
:param dict config: Configuration.
:return bool: True if configuration is valid.
"""
if '{content}' in config['embed_format'] and config['format'] != 'svg':
raise ConfigurationError(
'embed_format', config['embed_format'],
'cannot inline content of non-SVG format')

def rewrite_image_embeds(self, page_dest_path, output_content, config: Configuration):
"""Rewrite image embeds.
Expand Down
1 change: 1 addition & 0 deletions mkdocs_drawio_exporter/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def on_config(self, config):
self.config['drawio_executable'],
DrawIoExporter.DRAWIO_EXECUTABLE_NAMES,
self.exporter.drawio_executable_paths(sys.platform))
self.exporter.validate_config(self.config)
except ConfigurationError as e:
raise mkdocs.exceptions.ConfigurationError(str(e))

Expand Down

0 comments on commit 5f80955

Please sign in to comment.