Publii icon indicating copy to clipboard operation
Publii copied to clipboard

Is there any documentation on plugin development? Need help with addInsertions and addModifiers

Open reedjones opened this issue 1 year ago • 2 comments

I've been looking for documentation on plugin development, haven't found any. Does it exist? If not, is this something that's planned? I would be willing to contribute.

I posted a question on the forums that I'll repost here:

Looking at some of the example we have API.addInsertions, API.addEvents, and API.addModifiers 

When to use which? 

In the following code we see addInsertion with 'customCommentsCode' as the first argument, where :

this.API.addInsertion('customCommentsCode', this.addPostScripts, 1, this);

Some other examples:


this.API.addInsertion('publiiHead', this.addStyles, 1, this);
this.API.addInsertion('publiiFooter', this.addScripts, 1, this);

The parameters to addInsertion are: place, callback, priority, pluginInstance

So above 'publiiHead' is a place

I guess one question is what/where are these places? Can we stick any value in there? etc... 

The same goes for addModifiers

this.API.addModifier('postText', this.addDecodingAttribute, 1, this);

In this code how do we know that 'postText' is a valid value, is there a list or something somewhere?

Thank you!

reedjones avatar Oct 22 '23 06:10 reedjones

apparently there's no documentation yet

atomGit avatar Oct 22 '23 12:10 atomGit

Heads up, there has been a WIP version since Feb. https://github.com/GetPublii/Publii/discussions/1359

WishesofHue avatar Apr 03 '24 02:04 WishesofHue