Adding functionality to Pressbooks

Hello, we want to add a functionality to the glossary page. We did it on a local dev environment, but the ‘wrong way’ cause we edited the pressbooks plugin code directly (my fault).

But now we want to make it an addon plugin so it is not overridden by updates.

The rationale is this:
When a glossary has a large number of terms scrolling to find a term can be tedious. We implemented a letter navigation that scrolls to the beginning of each letter… in a self hosted instance of Pressbooks.

And my question is:
Is there a pathway or any example to see how to create addon plugins for pressbooks? I know there is a couple of them, but haven’t looked at them closely. Or does somebody want to do it? cause we’re not sure how to create a plugin like this.

You can see what we did here in this file if you want to prove it, it works like a charm:

It is not possible to see live cause the site is local but it looks like this:

*This lacks the styles cause for now is in the theme CSS.