-
-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dynamic use while rendering Markdown pages #8
Comments
Ah, maybe the temporary file is deleted too early. |
The clear issue here is that mkdocs_gen_files runs within the mkdocs-gen-files/mkdocs_gen_files/plugin.py Lines 27 to 30 in 4d5d4ac
In terms of a solution, I don't have any suggestions yet. |
https://oprypin.github.io/mkdocs/dev-guide/plugins/#events Ah and Markdown rendering is all done between |
Thanks, I get it now. That seems indeed a bit bold to modify files at such a stage of the build. And if you provide a way to do it, I guess users will try to generate Markdown files that way 😅 ... I wonder if there's a way for me to obtain and keep a reference to the |
There was a much simpler solution, which is to encode the PNG image as base64 and include it in the HTML with |
I'm reopening, because now I'm generate mp4 files, and inlining them in the HTML, base64 encoded, is not very efficient. It would be better to use an URL instead of base64 data, for smaller loading times and better browser perfs. |
Hey @oprypin!
I'm working on a simple Markdown extension that allows to execute code blocks and inject their output in the page.
I'm building a small gallery of examples, and am currently trying to write a
diagram
example:The issue is that, by the time this code is executed,
FilesEditor._current
isNone
again, so opening a file withmkdocs_gen_files.open
triggers the creation of another instance ofFilesEditor
without a temporary directory attached. It means that files I create this way end up in my docs dir, which is unwanted.So I attach a temporary directory myself:
But then it seems the file is not added to the final site because I'm getting a 404 😕
The text was updated successfully, but these errors were encountered: