diff --git a/d2/plugin.py b/d2/plugin.py index 0e4b697..8a00565 100644 --- a/d2/plugin.py +++ b/d2/plugin.py @@ -51,12 +51,14 @@ def on_config(self, config: MkDocsConfig) -> Optional[MkDocsConfig]: raise ConfigurationError(f"executable '{self.config.executable}' not found") raw_version = result.stdout.decode().strip() raw_version = raw_version.split("-")[0] # remove git commit info - d2_version = version.parse(raw_version) - if d2_version < REQUIRED_VERSION: - warning( - f"required d2 version {REQUIRED_VERSION} not satisfied " - "or version format not recognized; found {d2_version}" - ) + try: + d2_version = version.parse(raw_version) + if d2_version < REQUIRED_VERSION: + warning( + f"required d2 version {REQUIRED_VERSION} not satisfied; found {d2_version}" + ) + except version.InvalidVersion: + warning(f"version format not recognized; found {raw_version}") renderer = partial(render, self.config.executable, self.cache) # type: ignore