hovercraft icon indicating copy to clipboard operation
hovercraft copied to clipboard

Adding directive plugins

Open pedrohdz opened this issue 4 years ago • 3 comments

Hey all! Before I proceed, please keep in mind that this is a proof of concept/work in progress. I would like to get general feedback before finishing up the code, adding tests (including fixing the existing tests), updating the documentation, and so on.

I just want to make sure I'm heading the the correct general direction first.

There are a couple of high level parts to this:

  1. Add the --directive-plugin|-D [DIRECTIVE_PLUGIN_MODULE] argument to the hovercraft command to make it easier to add third-party Docutils directives.
  2. Simplify/standardize adding builtin Docutil directives. Take a peek at hovercraft/directive/null.py in the PR.

I started implementing a PlantUML plugin which can be found at pedrohdz/muextensions. The documentation on how to use it with Hovercraft! is in the README. Here is the general idea:

python3.7 -m venv .venv
source .venv/bin/activate
pip install -U pip
pip install muextensions \
    https://github.com/pedrohdz/hovercraft/archive/directives.zip
hovercraft --directive-plugin muextensions.contrib.hovercraft demo.rst

Please let me know what you all think. I can add the finishing touches if this is looking good so far, along with implementing any recommendations.

Thanks!

pedrohdz avatar Aug 08 '19 16:08 pedrohdz

I like the idea of a plugin architecture, but so far you don't do anything but register the plugins, so you need to flesh this out a bit first before I can have an opinion.

regebro avatar Sep 15 '19 09:09 regebro

Hey @regebro ! Thanks for taking a quick peek. Maybe I should not be using the work "plugin" at all here? :-)

The use case I am after here is the ability to register Docutil directives. As far as I can tell, thing we need to accomplishing this is registering the directive on start up. Are there other plugin points I missed?

I could use a different naming convention that does not include the name "plugin" not sure what that would be though. Open to suggestions. It is a "directive plugin" though.

Another option is generalizing the naming so it can be expanded to include other types of plugins in the future. If that is the goal, what other types of plugins are you envisioning, use cases, connection points?

Let me know! And thanks again!

pedrohdz avatar Oct 14 '19 07:10 pedrohdz

Yeah, calling it a plugin when you are only registering directives seems overkill. And you don't need to first register the plugin to later register the directive, I think, you could just register the directive directly.

I'll think about what other plugin points there could be. If I can't come up with anything we'll just add directives.

regebro avatar Oct 14 '19 08:10 regebro