Closed hafeja closed 5 months ago
First of all: Cool plugin @timvink , I like it!
Thanks!
What needs to be done in order to see drawio content at /print_page/?
First of all, I noticed that mkdocs-drawio-file
is not maintained anymore, and there is a new version mkdocs-drawio
.
I had a quick look at the source code of mkdocs_drawio/
(https://github.com/tuunit/mkdocs-drawio/blob/main/mkdocs_drawio/plugin.py). The main hook is on_post_page()
.
This plugin saves the HTML before any template is applied, during the on_page_content
event. Then on the on_post_build
event, we combine the HTMLs of all the page and then apply the templating (template styling basically).
If you look at the mkdocs documentation for plugins, you can see the diagram for the order of plugins events
This should clarify it:
So the processing by the mkdocs_drawio
is skipped. The solution is to add the post processing to the HTML of the print-site page explicitly, like we do for some other plugins:
Would you be willing to look into making a PR?
Perhaps @tuunit can chip in also? Because it would help if the mkdocs-drawio
plugin would have a single function that is not dependent on self
. Something like replace_drawio(html: str, path: Path, viewer_js_url: str) -> str
. Then we can use that in this plugin
Thanks for the hint that https://pypi.org/project/mkdocs-drawio/ supersedes https://pypi.org/project/mkdocs-drawio-file/!
Would you be willing to look into making a PR?
If I was skilled enough, I would ;-) Therefore, I like your idea to kindly ask @tuunit for professional support.
Hi together,
sorry for the late reply. Unfortunately all notifications from this thread have been wrongly filtered away by a misconfigured email filter. Thats on me, I'll have a look at the proposed changes and compatibility in the upcoming days.
@timvink @hafeja I just released a new version 1.6.0 of mkdocs-drawio
and opened the PR #100 to introduce the rendering support of the diagrams on the /print_page/
endpoint
Should be fixed with #100
released v2.4.0 to pypi
Works like expected. Thank you @timvink , @tuunit !! ❤️
First of all: Cool plugin @timvink , I like it!
Expected behavior
Drawio diagrams which are part of the mkdocs project are contained in the printed page using
/print_page/
.Actual behavior
Drawio diagrams which are part of the mkdocs project are NOT contained in the printed page using
/print_page/
.Environment
Ubuntu 22. Following packages are installed using pip in virtual environment.
Remark: Drawio content is added according to the documentation like this:
![](my-diagram.drawio)
Question
What needs to be done in order to see drawio content at
/print_page/
?Any feedback is much appreciated!