Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ By default the plugin uses the official url for the minified drawio javascript l

> If you want to use a self-hosted JavaScript viewer file. You should download the latest version from the [official drawio repo](https://github.com/jgraph/drawio/blob/dev/src/main/webapp/js/viewer-static.min.js).

Self-hosted viewer paths can be configured as site-root paths such as `/js/viewer-static.min.js`. The plugin normalizes them per page, so they also work on versioned deployments such as `mike`.

```yaml
plugins:
- drawio:
Expand Down
2 changes: 2 additions & 0 deletions examples/docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

By default the plugin uses the official url for the minified drawio javascript library. To use a custom source for the drawio viewer you can overwritte the url. This might be useful in airlocked environments.

Self-hosted viewer paths can be configured as site-root paths such as `/js/viewer-static.min.js`. The plugin normalizes them per page, so they also work on versioned deployments such as `mike`.

```yaml
plugins:
- drawio:
Expand Down
4 changes: 2 additions & 2 deletions mkdocs_drawio/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from pathlib import Path
from typing import Dict
from bs4 import BeautifulSoup
from mkdocs.utils import copy_file
from mkdocs.utils import copy_file, normalize_url
from mkdocs.plugins import BasePlugin
from mkdocs.config import base, config_options as c

Expand Down Expand Up @@ -164,7 +164,7 @@ def render_drawio_diagrams(self, output_content, page):
return output_content

# add drawio library to body
lib = soup.new_tag("script", src=self.config.viewer_js)
lib = soup.new_tag("script", src=normalize_url(self.config.viewer_js, page))
soup.body.append(lib)

# substitute images with embedded drawio diagram
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "mkdocs-drawio"
version = "1.16.1"
version = "1.16.2"
description = "MkDocs plugin for embedding Drawio files"
authors = [
"Jan Larwig <jan@larwig.com>",
Expand Down
Loading