Giter Site home page Giter Site logo

Comments (7)

hafeja avatar hafeja commented on June 3, 2024 2

Works like expected. Thank you @timvink , @tuunit !! ❤️

from mkdocs-print-site-plugin.

timvink avatar timvink commented on June 3, 2024 1

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:

image

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:

if config.get("plugins", {}).get("charts"):
html = (
config.get("plugins", {})
.get("charts")
.add_javascript_variables(html, self.print_page, config)
)

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

from mkdocs-print-site-plugin.

tuunit avatar tuunit commented on June 3, 2024 1

@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

from mkdocs-print-site-plugin.

hafeja avatar hafeja commented on June 3, 2024

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.

from mkdocs-print-site-plugin.

tuunit avatar tuunit commented on June 3, 2024

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.

from mkdocs-print-site-plugin.

timvink avatar timvink commented on June 3, 2024

Should be fixed with #100

from mkdocs-print-site-plugin.

timvink avatar timvink commented on June 3, 2024

released v2.4.0 to pypi

from mkdocs-print-site-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.