tajmone / highlight

Source code to formatted text converter
http://www.andre-simon.de
GNU General Public License v3.0
45 stars 4 forks source link

Which plugins are available for highlight? #10

Open michaelsjackson opened 4 years ago

michaelsjackson commented 4 years ago

Do we have any collection of available plugins for highlight, to be used as interesting starting points?

My goal is achieving this: https://gitlab.com/saalen/highlight/-/issues/157

tajmone commented 4 years ago

The plugins folder in the repository (also included with the distribution package) contains all the Highlight plugins:

https://gitlab.com/saalen/highlight/-/tree/master/plugins

some of them are intended for learning purposes, and you might find useful comments within them.

As far as I know, the Highlight project welcomes third party plugins contributions, so there shouldn't be plugins collections in the wild — the only reasons for a plugin not be included in the main project is either because its author doesn't want to share it (e.g. being proprietary), or because it was tailored for a particular use which makes it useless for most people, or due to license incompatibility.

As for what you're trying to achieve, I believe it's now possible to do so via some new plugins functions that were added fairly recently (e.g. AddKeyword(keyword, kwGroupID)) which allows to manually add a keyword to the internal list of keywords for the current syntax;

https://gitlab.com/saalen/highlight/-/blob/master/README_PLUGINS.adoc#user-content-functions-addkeywordremovekeyword

I'm not sure whether you can actually load a file though, since these are hook functions that are invoked when certain syntax-parsing events occur, whereas you're looking for a way to populate the list with the additional keywords before parsing even starts.

You might need to ask André (i.e. saalen on GitLab) on how/if this might be done. Chances are that there are undocumented features of the Lua/C++ interface that might allow you to hook into the parsing initialization stage and add extra keywords to a given group.