Giter Site home page Giter Site logo

Comments (7)

jimporter avatar jimporter commented on September 28, 2024 1

@kamilkrzyskow mike's loading of the config is totally separate from the mkdocs build action that happens later (mike can't really control MkDoc's internal plugin lifecycle anyway). This way avoids any possible strangeness with nested startup events, and gives plugins a chance to clean themselves up during the mike "pre-build" phase.

from mike.

jimporter avatar jimporter commented on September 28, 2024 1

OK, if the mkdocs build happens later then it's all good, and sorry for jumping the gun. I'm still unsure whether or not running the on_config event for all plugins is really necessary during load, as it seems to me you only need to run the mike's plugin on_config event to get what you need. 🤔

Plugins can do arbitrary things to transform the config during on_config, so we probably want to do that. For example, someone could write a plugin that automatically fills in values for remote_branch and remote_name (or even fill in some special values for the mike plugin).

from mike.

kamilkrzyskow avatar kamilkrzyskow commented on September 28, 2024

For continuity, since squidfunk/mkdocs-material@55fe1cc the Group plugin in mkdocs-material won't crash mike. However, running on_config without first running on_startup should still be addressed here.

def load_config(config_file=None, **kwargs):
with _open_config(config_file) as f:
cfg = mkdocs.config.load_config(f, **kwargs)
return cfg['plugins'].run_event('config', cfg)

from mike.

shamoon avatar shamoon commented on September 28, 2024

Thanks for your continued dedication to the project!

from mike.

kamilkrzyskow avatar kamilkrzyskow commented on September 28, 2024

But why are both startup and shutdown being run during load of the config @jimporter?
I feel like this will completely break the lifecycle of plugins that open a resource in startup then use it later in post_build and close the resource in shutdown.
I think any event triggers should be outside of the load_config utils function and should be exported into the driver itself to mimic the proper event lifecycle, but I'm just guessing.

from mike.

kamilkrzyskow avatar kamilkrzyskow commented on September 28, 2024

Unless this is a patch just for the load function, and later on it runs the full lifecycle again. I didn't check how the driver works in it's entirety.

from mike.

kamilkrzyskow avatar kamilkrzyskow commented on September 28, 2024

OK, if the mkdocs build happens later then it's all good, and sorry for jumping the gun.
I'm still unsure whether or not running the on_config event for all plugins is really necessary during load, as it seems to me you only need to run the mike's plugin on_config event to get what you need. 🤔

from mike.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.