Skip to content

Commit ec5f085

Browse files
authored
feat: add support for drawio.svg (#31)
Signed-off-by: Jan Larwig <[email protected]>
1 parent 5053149 commit ec5f085

File tree

5 files changed

+24
-2
lines changed

5 files changed

+24
-2
lines changed

examples/docs/tests/svg/index.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# SVG diagram
2+
3+
## Example
4+
5+
The following is a SVG based drawio diagram:
6+
7+
![](test.drawio.svg)
8+
9+
You can open the diagram as an SVG in your browser. [Click here.](test.drawio.svg)
10+
11+
## Markdown
12+
13+
```markdown
14+
![](test.drawio.svg)
15+
```
Lines changed: 4 additions & 0 deletions
Loading

examples/mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ nav:
1515
- Relative Paths (Subpage): "tests/relative-paths/example.md"
1616
- Pagging: "tests/pagging/index.md"
1717
- External URL: "tests/external-url/index.md"
18+
- SVG Diagram: "tests/svg/index.md"
1819

1920
theme:
2021
name: material

mkdocs_drawio/plugin.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ def render_drawio_diagrams(self, output_content, page):
5252
}
5353

5454
# search for images using drawio extension
55-
diagrams = soup.find_all("img", src=re.compile(r".*\.drawio$", re.IGNORECASE))
55+
diagrams = soup.find_all(
56+
"img", src=re.compile(r".*\.drawio(.svg)?$", re.IGNORECASE)
57+
)
5658
if len(diagrams) == 0:
5759
return output_content
5860

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "mkdocs-drawio"
3-
version = "1.9.0"
3+
version = "1.10.0"
44
description = "MkDocs plugin for embedding Drawio files"
55
authors = [
66
"Jan Larwig <[email protected]>",

0 commit comments

Comments
 (0)