Add Plugins?

Any thoughts on plugins?

I had a need for math. I ended up using a Tera filter to turn asciimath into mathml and a shortcode, which made me think that Tera filters could be a great spot for plugins. Where else could plugins fit? Are plugins a good idea?

The problem with plug-ins is that they would either be not very mighty or require a built-in scripting language. Assuming that @keats will never accept code which cannot be plugged right into the Zola binary, that limits our choices (which is a good thing, honestly).

My own SSG (which I won’t advertise here) uses the Duktape JavaScript engine for that, with a number of predefined hooks throughout the application. There are at least a few Rust Duktape wrappers, so it would be an option.

The more interesting question is which missing feature plug-ins would actually need to cover and whether that feature shouldn’t better be baked into Zola. And here I need to vote for the latter, I’m afraid - for security and performance reasons.

I was thinking maybe dynamic linking? Zola could load a dll that exports Tera filters for example. That would be powerful without needing to embed a scripting engine. I’m not sure what other places would be easy / useful to add hooks. Adding Tera filters is the only spot I can think of right now.

I admit that there’s probably not a huge user experience improvement between writing a dylib and just forking Zola so… it’s just a thought.

1 Like

Then, maybe, this should rather be a Tera feature request.

Lua could be statically linked into binary and is quite easy to interop with (via mlua crate, for example).

I’m trying to integrate Lua into Zola fork for my own blog (because plugins is a critical feature for me). I would be happy to make PR into upstream and/or make my patches public.

I made a prototype of Zola-with-plugins.

It’s horrible, slow and horrible, but it works for me.
Example plugins:

1 Like