{"id":6001,"library":"mkdocs-simple-hooks","title":"MkDocs Simple Hooks","description":"mkdocs-simple-hooks is a deprecated Python plugin for MkDocs that allowed users to define custom hooks directly within their project's Python modules without needing to create a separate MkDocs plugin package. Its functionality has been natively implemented in MkDocs 1.4 and later. The current version is 0.1.5, with the last release in January 2022, indicating an inactive release cadence.","status":"deprecated","version":"0.1.5","language":"en","source_language":"en","source_url":"https://github.com/aklajnert/mkdocs-simple-hooks","tags":["mkdocs","plugin","hooks","documentation","deprecated"],"install":[{"cmd":"pip install mkdocs-simple-hooks","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"This is an MkDocs plugin and requires MkDocs to function.","package":"mkdocs"}],"imports":[{"note":"Hooks are defined as Python functions in a module (e.g., 'docs/hooks.py') and referenced as a string in mkdocs.yml, not directly imported into Python code.","symbol":"Hook definition in mkdocs.yml","correct":"plugins:\n  - mkdocs-simple-hooks:\n      hooks:\n        on_pre_build: \"docs.hooks:copy_readme\""}],"quickstart":{"code":"# 1. Create a Python file, e.g., 'docs/hooks.py'\n# content of docs/hooks.py:\nimport shutil\n\ndef copy_readme(*args, **kwargs):\n    shutil.copy('README.md', 'docs/index.md')\n\n# 2. Configure mkdocs.yml (add this to your existing mkdocs.yml):\n# plugins:\n#   - mkdocs-simple-hooks:\n#       hooks:\n#         on_pre_build: \"docs.hooks:copy_readme\"\n\n# 3. Ensure 'mkdocs' is installed and run from your project root:\n# pip install mkdocs\n# mkdocs build\n# mkdocs serve","lang":"python","description":"To get started, define your hook functions in a Python file (e.g., `docs/hooks.py`) and then reference these functions in your `mkdocs.yml` configuration under the `plugins.mkdocs-simple-hooks.hooks` section. The example demonstrates copying `README.md` to `docs/index.md` before the build process."},"warnings":[{"fix":"Remove `mkdocs-simple-hooks` from `mkdocs.yml` and `requirements.txt`. Refactor hook functions to be directly referenced under the `hooks:` configuration in `mkdocs.yml` as per MkDocs documentation.","message":"This plugin is officially deprecated and no longer supported as MkDocs 1.4.0 and later versions include native support for hooks, making this plugin redundant. Users are strongly advised to migrate to the native MkDocs hooks functionality.","severity":"breaking","affected_versions":"All versions of mkdocs-simple-hooks with MkDocs >= 1.4.0"},{"fix":"Ensure your `mkdocs.yml` explicitly lists all desired plugins: `plugins: [search, mkdocs-simple-hooks]`","message":"If you don't have a `plugins` entry in your `mkdocs.yml`, MkDocs typically enables the `search` plugin by default. When you add `mkdocs-simple-hooks`, you must explicitly list `search` if you still want it, as adding any plugin disables implicit defaults.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Configure in `mkdocs.yml`: `plugins: - mkdocs-simple-hooks: enabled: !ENV [ENABLE_MKDOCS_SIMPLE_HOOKS, True]` and set `ENABLE_MKDOCS_SIMPLE_HOOKS` accordingly in your environment.","message":"To enable/disable the plugin dynamically, especially in different environments, you can use MkDocs' `!ENV` tag with an environment variable. Without careful handling, the plugin might be active when not intended or vice-versa.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-14T00:00:00.000Z","next_check":"2026-07-13T00:00:00.000Z"}