reveal-hugo icon indicating copy to clipboard operation
reveal-hugo copied to clipboard

How can I pass a parameter to a plugin's initialization?

Open hartzell opened this issue 5 years ago • 2 comments

I'd like to use the reveal.js-menu plugin.

I started with the sample programming quotes repository.

I've copied the menu plugin repository into ./themes/reveal-hugo/static/reveal-js/plugin/menu/.

I've edited content/_index.md and added

[reveal_hugo]
plugins = ["reveal-js/plugin/menu/menu.js"]

to the front matter.

I'd like to set so of the menu plugins parameters, e.g. side, but I can't find any documentation or figure it out from first principles.

I've tried

plugins_menu_side = "right"

In the front matter, to no avail.

Is this possible?

hartzell avatar Feb 24 '20 17:02 hartzell

For this you might need to write some custom JavaScript to register the plugin. You could do that in a file called end.html in the layouts/partials/reveal-hugo directory (check the docs to make sure I got that right).

There is some info about registering plugins after initialization here:

https://github.com/hakimel/reveal.js/blob/master/README.md#plugins

Reveal.registerPlugin( 'myPlugin', MyPlugin );

joshed-io avatar Feb 24 '20 23:02 joshed-io

This might be possible in a future iteration of #133. We could add a field containing plugin initializers. But I would wait for the reveal-js upgrade before having a stab at that.

davidovich avatar Nov 29 '22 01:11 davidovich