-
Notifications
You must be signed in to change notification settings - Fork 953
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
Add defalte filters #1622
base: next
Are you sure you want to change the base?
Add defalte filters #1622
Conversation
I can see the need for decompressing but compressing? |
Compressing is needed so that a diagram code (PlantUML, Diag, etc) could be compressed and sent to Kroki or to the PlantUML public server (see the compression section in docs). This is my primary use case for this actually 🙂 |
Does that mean that you re-do the request on every file change in zola serve? |
Yes, right now I'm using the |
An example use of this filter is like this: {% plantuml(comment="simple diagram") %}
participant Zola
participant Kroki
Zola -> Kroki: POST /plantuml/svg\nContent-type: text/plain\n<diagram_data>
activate Zola
Kroki -> Zola: SVG image
deactivate Zola
Zola -> Zola: embed SVG into HTML
{% end %} Then in <figure class="image">
<img src="https://kroki.io/plantuml/svg/{{body | deflate_compress}}"/>
</figure> Which will render into <figure class="image">
<img src="https://kroki.io/plantuml/svg/eNpVzsEKwjAMBuB7nyIvMHYfsosHBRWFDQ8ykLiGEWzTUuPQt9daBD3-Px9_EjEpjxxRFE7BoYk_xSaFKxuTe6jaEhs47Lse6uje4u5dfZunQZZBlEQrfUZqQOmhGbAMsrCMU0J_tqjYGhyVZ1Qqxz6LeTqnBrrjCtjjRMbSP_y-UBz5C9miRQOs-932BfL4RXE="/>
</figure> |
@Keats , so what do you think about this? Any chances to get it merged until the next release? |
I think I need to see some more people wanting that feature before merging it. |
What would be the best way to make people aware of such proposals in order to get feedback? Rust's proposals are mentioned in the "This Week In Rust" newsletter. Maybe for Zola it will make sense to mention such things in changelogs to reach wider audience? I don't think a lot of people check PRs here or the forum. |
Yeah the forum is not checked as often. Maybe create an issue on the repo, people do check those before creating a new one usually. You can point to the PR and the forum. |
1e55db1
to
3155662
Compare
This feature looks interresting to me. It would be nice to adjust the image format (svg/png) and maybe the plantuml-server-url, sending the data to. In case the default will be inaccessible or if the data might be secret. Maybe https://github.com/migmedia/planturl can be usefull. |
It's a shortcode {% set postdata = load_data(
url="https://kroki.io/plantuml/svg",
format="plain", method="POST",
content_type="text/plain",
body=body,
required=true,
)
%}
<figure class="image">
{{ postdata | safe }}
<figcaption class="comment">
{% if comment %}
<em>{{ comment | markdown | safe }}</em>
{% endif %}
<em>Open as <a href="https://kroki.io/plantuml/png/{{body | deflate_compress}}">image</a></em>
</figcaption>
</figure> You can easily adjust the format and server URL. |
8b1a413
to
67c2fe0
Compare
Add deflate filters as discussed on the forum
Sanity check:
Code changes
(Delete or ignore this section for documentation changes)
next
branch?If the change is a new feature or adding to/changing an existing one: