Provide a plugin event triggered as early as possible
See original GitHub issueOur earliest triggered plugin event, setup-env
, occurs after the Environment
is initialized. If we create an even earlier plugin event, even more things might be possible.
E.g. Jinja extensions have to subclass jinja’s Extension
before the creation of the jinja env, which happens in the instantiation of our Lektor env. A plugin using a super early event could do this to allow a custom jinja extension to be picked up and added during the env creation.
Being super early, other things are possible too. Some adventurous plugin developer could even patch or rewrite a lot of Lektor classes before they’re called. There’s a lot of possibilities.
setup-env
should not move, as that would potentially break things, and it’s name still fits since it’s right after the environment is created, but we could rework the plugin loading a little to allow for running a generic plugin at an even earlier step.
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (10 by maintainers)
Top GitHub Comments
While I generally agree with that comment and like having specific events like the markdown events, it posses the same technical hurdle of reworking the plugin loading system because it’s still at an earlier point than the
setup-env
event. I would have considered making that a dedicated event, but I still also like the power afforded to an even earlier event too.That said, I just closed #778 because I discovered my assumption leading down this path was wrong. So, this isn’t needed for adding Jinja extensions. This is now a design change in search of a well-defined feature. Possibly #751.
See also #281