diff --git a/about/release-notes/index.html b/about/release-notes/index.html index 078cfb2f..a3e7052c 100644 --- a/about/release-notes/index.html +++ b/about/release-notes/index.html @@ -385,6 +385,8 @@ See document

Customize event order for plugin event handlers (#2973)

Plugins can now choose to set a priority value for their event handlers. This can override the old behavior where for each event type, the handlers are called in the order that their plugins appear in the plugins config.

If this is set, events with higher priority are called first. Events without a chosen priority get a default of 0. Events that have the same priority are ordered as they appear in the config.

+

Recommended priority values: 100 "first", 50 "early", 0 "default", -50 "late", -100 "last".
+As different plugins discover more precise relations to each other, the values should be further tweaked.

See documentation.

New events that persist across builds in mkdocs serve (#2972)

The new events are on_startup and on_shutdown. They run at the very beginning and very end of an mkdocs invocation.
diff --git a/index.html b/index.html index 54f6373c..efd89630 100644 --- a/index.html +++ b/index.html @@ -342,5 +342,5 @@ configuration file. Start by reading the introductory diff --git a/search/search_index.json b/search/search_index.json index 87ad4200..bcf020b7 100644 --- a/search/search_index.json +++ b/search/search_index.json @@ -1 +1 @@ -{"config":{"indexing":"full","lang":["en"],"min_search_length":3,"prebuild_index":false,"separator":"[\\s\\-]+"},"docs":[{"location":"","text":"

Project documentation with\u00a0Markdown.

MkDocs is a fast, simple and downright gorgeous static site generator that's geared towards building project documentation. Documentation source files are written in Markdown, and configured with a single YAML configuration file. Start by reading the introductory tutorial, then check the User Guide for more information.

Getting Started User Guide Features Great themes available

There's a stack of good looking themes available for MkDocs. Choose between the built in themes: mkdocs and readthedocs, select one of the third-party themes listed on the MkDocs Themes wiki page, or build your own.

Easy to customize

Get your project documentation looking just the way you want it by customizing your theme and/or installing some plugins. Modify Markdown's behavior with Markdown extensions. Many configuration options are available.

Preview your site as you work

The built-in dev-server allows you to preview your documentation as you're writing it. It will even auto-reload and refresh your browser whenever you save your changes.

Host anywhere

MkDocs builds completely static HTML sites that you can host on GitHub pages, Amazon S3, or anywhere else you choose.

","title":"MkDocs"},{"location":"getting-started/","text":"

An introductory tutorial!

","title":"Getting Started with MkDocs"},{"location":"getting-started/#installation","text":"

To install MkDocs, run the following command from the command line:

pip install mkdocs

For more details, see the Installation Guide.

","title":"Installation"},{"location":"getting-started/#creating-a-new-project","text":"

Getting started is super easy. To create a new project, run the following command from the command line:

mkdocs new my-project\ncd my-project

Take a moment to review the initial project that has been created for you.

There's a single configuration file named mkdocs.yml, and a folder named docs that will contain your documentation source files (docs is the default value for the docs_dir configuration setting). Right now the docs folder just contains a single documentation page, named index.md.

MkDocs comes with a built-in dev-server that lets you preview your documentation as you work on it. Make sure you're in the same directory as the mkdocs.yml configuration file, and then start the server by running the mkdocs serve command:

$ mkdocs serve\nINFO    -  Building documentation...\nINFO    -  Cleaning site directory\n[I 160402 15:50:43 server:271] Serving on http://127.0.0.1:8000\n[I 160402 15:50:43 handlers:58] Start watching changes\n[I 160402 15:50:43 handlers:60] Start detecting changes

Open up http://127.0.0.1:8000/ in your browser, and you'll see the default home page being displayed:

The dev-server also supports auto-reloading, and will rebuild your documentation whenever anything in the configuration file, documentation directory, or theme directory changes.

Open the docs/index.md document in your text editor of choice, change the initial heading to MkLorum, and save your changes. Your browser will auto-reload and you should see your updated documentation immediately.

Now try editing the configuration file: mkdocs.yml. Change the site_name setting to MkLorum and save the file.

site_name: MkLorum\nsite_url: https://example.com/

Your browser should immediately reload, and you'll see your new site name take effect.

Note

The site_name and site_url configuration options are the only two required options in your configuration file. When you create a new project, the site_url option is assigned the placeholder value: https://example.com. If the final location is known, you can change the setting now to point to it. Or you may choose to leave it alone for now. Just be sure to edit it before you deploy your site to a production server.

","title":"Creating a new project"},{"location":"getting-started/#adding-pages","text":"

Now add a second page to your documentation:

curl 'https://jaspervdj.be/lorem-markdownum/markdown.txt' > docs/about.md

As our documentation site will include some navigation headers, you may want to edit the configuration file and add some information about the order, title, and nesting of each page in the navigation header by adding a nav setting:

site_name: MkLorum\nsite_url: https://example.com/\nnav:\n    - Home: index.md\n    - About: about.md

Save your changes and you'll now see a navigation bar with Home and About items on the left as well as Search, Previous, and Next items on the right.

Try the menu items and navigate back and forth between pages. Then click on Search. A search dialog will appear, allowing you to search for any text on any page. Notice that the search results include every occurrence of the search term on the site and links directly to the section of the page in which the search term appears. You get all of that with no effort or configuration on your part!

","title":"Adding pages"},{"location":"getting-started/#theming-our-documentation","text":"

Now change the configuration file to alter how the documentation is displayed by changing the theme. Edit the mkdocs.yml file and add a theme setting:

site_name: MkLorum\nsite_url: https://example.com/\nnav:\n    - Home: index.md\n    - About: about.md\ntheme: readthedocs

Save your changes, and you'll see the ReadTheDocs theme being used.

","title":"Theming our documentation"},{"location":"getting-started/#changing-the-favicon-icon","text":"

By default, MkDocs uses the MkDocs favicon icon. To use a different icon, create an img subdirectory in the docs directory and copy your custom favicon.ico file to that directory. MkDocs will automatically detect and use that file as your favicon icon.

","title":"Changing the Favicon Icon"},{"location":"getting-started/#building-the-site","text":"

That's looking good. You're ready to deploy the first pass of your MkLorum documentation. First build the documentation:

mkdocs build

This will create a new directory, named site. Take a look inside the directory:

$ ls site\nabout  fonts  index.html  license  search.html\ncss    img    js          mkdocs   sitemap.xml

Notice that your source documentation has been output as two HTML files named index.html and about/index.html. You also have various other media that's been copied into the site directory as part of the documentation theme. You even have a sitemap.xml file and mkdocs/search_index.json.

If you're using source code control such as git you probably don't want to check your documentation builds into the repository. Add a line containing site/ to your .gitignore file.

echo \"site/\" >> .gitignore

If you're using another source code control tool you'll want to check its documentation on how to ignore specific directories.

","title":"Building the site"},{"location":"getting-started/#other-commands-and-options","text":"

There are various other commands and options available. For a complete list of commands, use the --help flag:

mkdocs --help

To view a list of options available on a given command, use the --help flag with that command. For example, to get a list of all options available for the build command run the following:

mkdocs build --help
","title":"Other Commands and Options"},{"location":"getting-started/#deploying","text":"

The documentation site that you just built only uses static files so you'll be able to host it from pretty much anywhere. Simply upload the contents of the entire site directory to wherever you're hosting your website from and you're done. For specific instructions on a number of common hosts, see the Deploying your Docs page.

","title":"Deploying"},{"location":"getting-started/#getting-help","text":"

See the User Guide for more complete documentation of all of MkDocs' features.

To get help with MkDocs, please use the GitHub discussions or GitHub issues.

","title":"Getting help"},{"location":"about/contributing/","text":"

An introduction to contributing to the MkDocs project.

The MkDocs project welcomes, and depends, on contributions from developers and users in the open source community. Contributions can be made in a number of ways, a few examples are:

For information about available communication channels please refer to the README file in our GitHub repository.

","title":"Contributing to MkDocs"},{"location":"about/contributing/#code-of-conduct","text":"

Everyone interacting in the MkDocs project's codebases, issue trackers, chat rooms, and mailing lists is expected to follow the PyPA Code of Conduct.

","title":"Code of Conduct"},{"location":"about/contributing/#reporting-an-issue","text":"

Please include as much detail as you can. Let us know your platform and MkDocs version. If the problem is visual (for example a theme or design issue) please add a screenshot and if you get an error please include the full error and traceback.

","title":"Reporting an Issue"},{"location":"about/contributing/#testing-the-development-version","text":"

If you want to just install and try out the latest development version of MkDocs you can do so with the following command. This can be useful if you want to provide feedback for a new feature or want to confirm if a bug you have encountered is fixed in the git master. It is strongly recommended that you do this within a virtualenv.

pip install https://github.com/mkdocs/mkdocs/archive/master.tar.gz
","title":"Testing the Development Version"},{"location":"about/contributing/#installing-for-development","text":"

First you'll need to fork and clone the repository. Once you have a local copy, run the following command. It is strongly recommended that you do this within a virtualenv.

pip install --editable .

This will install MkDocs in development mode which binds the mkdocs command to the git repository.

","title":"Installing for Development"},{"location":"about/contributing/#running-the-tests","text":"

To run the tests, it is recommended that you use tox.

Install Tox using pip by running the command pip install tox. Then the test suite can be run for MkDocs by running the command tox in the root of your MkDocs repository.

It will attempt to run the tests against all of the Python versions we support. So don't be concerned if you are missing some and they fail. The rest will be verified by GitHub Actions when you submit a pull request.

","title":"Running the tests"},{"location":"about/contributing/#translating-themes","text":"

To localize a theme to your favorite language, follow the guide on Translating Themes. We welcome translation Pull Requests!

","title":"Translating themes"},{"location":"about/contributing/#submitting-pull-requests","text":"

If you're considering a large code contribution to MkDocs, please prefer to open an issue first to get early feedback on the idea.

Once you think the code is ready to be reviewed, push it to your fork and send a pull request. For a change to be accepted it will most likely need to have tests and documentation if it is a new feature.

","title":"Submitting Pull Requests"},{"location":"about/contributing/#submitting-changes-to-the-builtin-themes","text":"

When installed with i18n support (pip install mkdocs[i18n]), MkDocs allows themes to support being translated into various languages (referred to as locales) if they respect Jinja's i18n extension by wrapping text placeholders with {% trans %} and {% endtrans %} tags.

Each time a translatable text placeholder is added, removed or changed in a theme template, the theme's Portable Object Template (pot) file needs to be updated by running the extract_messages command. For example, to update the pot file of the mkdocs theme, run the following command:

python setup.py extract_messages -t mkdocs

The updated pot file should be included in a PR with the updated template. The updated pot file will allow translation contributors to propose the translations needed for their preferred language. See the guide on Translating Themes for details.

Note

Contributors are not expected to provide translations with their changes to a theme's templates. However, they are expected to include an updated pot file so that everything is ready for translators to do their job.

","title":"Submitting changes to the builtin themes"},{"location":"about/license/","text":"

The legal stuff.

","title":"License"},{"location":"about/license/#included-projects","text":"

Themes used under license from the ReadTheDocs projects.

Many thanks to the authors and contributors of those wonderful projects.

","title":"Included projects"},{"location":"about/license/#mkdocs-license-bsd","text":"

Copyright \u00a9 2014, Tom Christie. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

","title":"MkDocs License (BSD)"},{"location":"about/release-notes/","text":"","title":"Release Notes"},{"location":"about/release-notes/#upgrading","text":"

To upgrade MkDocs to the latest version, use pip:

pip install -U mkdocs

You can determine your currently installed version using mkdocs --version:

$ mkdocs --version\nmkdocs, version 1.0 from /path/to/mkdocs (Python 3.6)
","title":"Upgrading"},{"location":"about/release-notes/#maintenance-team","text":"

The current and past members of the MkDocs team.

","title":"Maintenance team"},{"location":"about/release-notes/#version-140-2022-09-27","text":"","title":"Version 1.4.0 (2022-09-27)"},{"location":"about/release-notes/#feature-upgrades","text":"","title":"Feature upgrades"},{"location":"about/release-notes/#hooks-2978","text":"

The new hooks: config allows you to add plugin-like event handlers from local Python files, without needing to set up and install an actual plugin.

See documentation.

","title":"Hooks (#2978)"},{"location":"about/release-notes/#edit_uri-flexibility-2927","text":"

There is a new edit_uri_template: config. It works like edit_uri but more generally covers ways to construct an edit URL. See documentation.

Additionally, the edit_uri functionality will now fully work even if repo_url is omitted (#2928)

","title":"edit_uri flexibility (#2927)"},{"location":"about/release-notes/#upgrades-for-plugin-developers","text":"

Note

This release has big changes to the implementation of plugins and their configs. But, the intention is to have zero breaking changes in all reasonably common use cases. Or at the very least if a code fix is required, there should always be a way to stay compatible with older MkDocs versions. Please report if this release breaks something.

","title":"Upgrades for plugin developers"},{"location":"about/release-notes/#customize-event-order-for-plugin-event-handlers-2973","text":"

Plugins can now choose to set a priority value for their event handlers. This can override the old behavior where for each event type, the handlers are called in the order that their plugins appear in the plugins config.

If this is set, events with higher priority are called first. Events without a chosen priority get a default of 0. Events that have the same priority are ordered as they appear in the config.

See documentation.

","title":"Customize event order for plugin event handlers (#2973)"},{"location":"about/release-notes/#new-events-that-persist-across-builds-in-mkdocs-serve-2972","text":"

The new events are on_startup and on_shutdown. They run at the very beginning and very end of an mkdocs invocation. on_startup also receives information on how mkdocs was invoked (e.g. serve --dirtyreload).

See documentation.

","title":"New events that persist across builds in mkdocs serve (#2972)"},{"location":"about/release-notes/#replace-filesrc_path-to-not-deal-with-backslashes-2930","text":"

The property src_path uses backslashes on Windows, which doesn't make sense as it's a virtual path. To not make a breaking change, there's no change to how this property is used, but now you should:

These consistently use forward slashes, and are now the definitive source that MkDocs itself uses.

See source code.

As a related tip: you should also stop using os.path.* or pathlib.Path() to deal with these paths, and instead use posixpath.* or pathlib.PurePosixPath()

","title":"Replace File.src_path to not deal with backslashes (#2930)"},{"location":"about/release-notes/#mkdocs-is-type-annotated-ready-for-use-with-mypy-2941-2970","text":"","title":"MkDocs is type-annotated, ready for use with mypy (#2941, #2970)"},{"location":"about/release-notes/#type-annotations-for-event-handler-methods-2931","text":"

MkDocs' plugin event methods now have type annotations. You might have been adding annotations to events already, but now they will be validated to match the original.

See source code and documentation.

One big update is that now you should annotate method parameters more specifically as config: defaults.MkDocsConfig instead of config: base.Config. This not only makes it clear that it is the main config of MkDocs itself, but also provides type-safe access through attributes of the object (see next section).

See source code and documentation.

","title":"Type annotations for event handler methods (#2931)"},{"location":"about/release-notes/#rework-configoption-schemas-as-class-based-2962","text":"

When developing a plugin, the settings that it accepts used to be specified in the config_scheme variable on the plugin class. This approach is now soft-deprecated, and instead you should specify the config in a sub-class of base.Config.

Old example:

from mkdocs import plugins\nfrom mkdocs.config import base, config_options\n\nclass MyPlugin(plugins.BasePlugin):\n    config_scheme = (\n        ('foo', config_options.Type(int)),\n        ('bar', config_options.Type(str, default='')),\n    )\n\n    def on_page_markdown(self, markdown: str, *, config: base.Config, **kwargs):\n        if self.config['foo'] < 5:\n            if config['site_url'].startswith('http:'):\n                return markdown + self.config['baz']

This code snippet actually has many mistakes but it will pass all type checks and silently run and even succeed in some cases.

So, on to the new equivalent example, changed to new-style schema and attribute-based access: (Complaints from \"mypy\" added inline)

from mkdocs import plugins\nfrom mkdocs.config import base, config_options as c\n\nclass MyPluginConfig(base.Config):\n    foo = c.Optional(c.Type(int))\n    bar = c.Type(str, default='')\n\nclass MyPlugin(plugins.BasePlugin[MyPluginConfig]):\n    def on_page_markdown(self, markdown: str, *, config: base.MkDocsConfig, **kwargs):\n        if self.config.foo < 5:  # Error, `foo` might be `None`, need to check first.\n            if config.site_url.startswith('http:'):  # Error, MkDocs' `site_url` also might be `None`.\n                return markdown + self.config.baz  # Error, no such attribute `baz`!

This lets you notice the errors from a static type checker before running the code and fix them as such:

class MyPlugin(plugins.BasePlugin[MyPluginConfig]):\n    def on_page_markdown(self, markdown: str, *, config: base.MkDocsConfig, **kwargs):\n        if self.config.foo is not None and self.config.foo < 5:  # OK, `int < int` is valid.\n            if (config.site_url or '').startswith('http:'):  # OK, `str.startswith(str)` is valid.\n                return markdown + self.config.bar  # OK, `str + str` is valid.

See documentation.

Also notice that we had to explicitly mark the config attribute foo as Optional. The new-style config has all attributes marked as required by default, and specifying required=False or required=True is not allowed!

","title":"Rework ConfigOption schemas as class-based (#2962)"},{"location":"about/release-notes/#new-config_optionsoptional-2962","text":"

Wrapping something into Optional is conceptually similar to \"I want the default to be None\" -- and you have to express it like that, because writing default=None doesn't actually work.

Breaking change: the method BaseConfigOption.is_required() was removed. Use .required instead. (#2938) And even the required property should be mostly unused now. For class-based configs, there's a new definition for whether an option is \"required\":

","title":"New: config_options.Optional (#2962)"},{"location":"about/release-notes/#new-config_optionslistofitems-2938","text":"

Defines a list of items that each must adhere to the same constraint. Kind of like a validated Type(list)

Examples how to express a list of integers (with from mkdocs.config import config_options as c):

Description Code entry Required to specify foo = c.ListOfItems(c.Type(int)) Optional, default is [] foo = c.ListOfItems(c.Type(int), default=[]) Optional, default is None foo = c.Optional(c.ListOfItems(c.Type(int)))

See more examples in documentation.

","title":"New: config_options.ListOfItems (#2938)"},{"location":"about/release-notes/#updated-config_optionssubconfig-2807","text":"

SubConfig used to silently ignore all validation of its config options. Now you should pass validate=True to it or just use new class-based configs where this became the default.

So, it can be used to validate a nested sub-dict with all keys pre-defined and value types strictly validated.

See examples in documentation.

","title":"Updated: config_options.SubConfig (#2807)"},{"location":"about/release-notes/#other-changes-to-config-options","text":"

URL's default is now None instead of ''. This can still be checked for truthiness in the same way - if config.some_url: (#2962)

FilesystemObject is no longer abstract and can be used directly, standing for \"file or directory\" with optional existence checking (#2938)

Bug fixes:

Tweaked logic for handling ConfigOption.default (#2938)

Deprecated config option classes: ConfigItems (#2983), OptionallyRequired (#2962), RepoURL (#2927)

","title":"Other changes to config options"},{"location":"about/release-notes/#theme-updates","text":"","title":"Theme updates"},{"location":"about/release-notes/#future-compatibility","text":"","title":"Future compatibility"},{"location":"about/release-notes/#incompatible-changes-to-public-apis","text":"","title":"Incompatible changes to public APIs"},{"location":"about/release-notes/#miscellaneous","text":"

Other small improvements; see commit log.

","title":"Miscellaneous"},{"location":"about/release-notes/#version-131-2022-07-19","text":"

Other small improvements; see commit log.

","title":"Version 1.3.1 (2022-07-19)"},{"location":"about/release-notes/#version-130-2022-03-26","text":"","title":"Version 1.3.0 (2022-03-26)"},{"location":"about/release-notes/#feature-upgrades_1","text":"","title":"Feature upgrades"},{"location":"about/release-notes/#bug-fixes","text":"","title":"Bug fixes"},{"location":"about/release-notes/#miscellaneous_1","text":"

Other small improvements; see commit log.

","title":"Miscellaneous"},{"location":"about/release-notes/#version-124-2022-03-26","text":"","title":"Version 1.2.4 (2022-03-26)"},{"location":"about/release-notes/#version-123-2021-10-12","text":"

Other small improvements; see commit log.

","title":"Version 1.2.3 (2021-10-12)"},{"location":"about/release-notes/#version-122-2021-07-18","text":"","title":"Version 1.2.2 (2021-07-18)"},{"location":"about/release-notes/#version-121-2021-06-09","text":"","title":"Version 1.2.1 (2021-06-09)"},{"location":"about/release-notes/#version-12-2021-06-04","text":"","title":"Version 1.2 (2021-06-04)"},{"location":"about/release-notes/#major-additions-to-version-12","text":"","title":"Major Additions to Version 1.2"},{"location":"about/release-notes/#support-added-for-theme-localization-2299","text":"

The mkdocs and readthedocs themes now support language localization using the theme.locale parameter, which defaults to en (English). The only other supported languages in this release are fr (French) and es (Spanish). For details on using the provided translations, see the user guide. Note that translation will not happen by default. Users must first install the necessary dependencies with the following command:

pip install mkdocs[i18n]

Translation contributions are welcome and detailed in the Translation Guide.

Developers of third party themes may want to review the relevant section of the Theme Development Guide.

Contributors who are updating the templates to the built-in themes should review the Contributing Guide.

The lang setting of the search plugin now defaults to the language specified in theme.locale.

","title":"Support added for Theme Localization (#2299)"},{"location":"about/release-notes/#support-added-for-environment-variables-in-the-configuration-file-1954","text":"

Environments variables may now be specified in the configuration file with the !ENV tag. The value of the variable will be parsed by the YAML parser and converted to the appropriate type.

somekey: !ENV VAR_NAME\notherkey: !ENV [VAR_NAME, FALLBACK_VAR, 'default value']

See Environment Variables in the Configuration documentation for details.

","title":"Support added for Environment Variables in the configuration file (#1954)"},{"location":"about/release-notes/#support-added-for-configuration-inheritance-2218","text":"

A configuration file may now inherit from a parent configuration file. In the primary file set the INHERIT key to the relative path of the parent file.

INHERIT: path/to/base.yml

The two files will then be deep merged. See Configuration Inheritance for details.

","title":"Support added for Configuration Inheritance (#2218)"},{"location":"about/release-notes/#update-gh-deploy-command-2170","text":"

The vendored (and modified) copy of ghp_import has been replaced with a dependency on the upstream library. As of version 1.0.0, ghp-import includes a Python API which makes it possible to call directly.

MkDocs can now benefit from recent bug fixes and new features, including the following:

","title":"Update gh-deploy command (#2170)"},{"location":"about/release-notes/#rework-auto-reload-and-http-server-for-mkdocs-serve-2385","text":"

mkdocs serve now uses a new underlying server + file watcher implementation, based on http.server from standard library and watchdog. It provides similar functionality to the previously used livereload library (which is now dropped from dependencies, along with tornado).

This makes reloads more responsive and consistent in terms of timing. Multiple rapid file changes no longer cause the site to repeatedly rebuild (issue #2061).

Almost every aspect of the server is slightly different, but actual visible changes are minor. The logging outputs are only similar to the old ones. Degradations in behavior are not expected, and should be reported if found.

","title":"Rework auto-reload and HTTP server for mkdocs serve (#2385)"},{"location":"about/release-notes/#offset-the-local-site-root-according-to-the-sub-path-of-the-site_url-2424","text":"

When using mkdocs serve and having the site_url specified as e.g. http://example.org/sub/path/, now the root of the locally served site becomes http://127.0.0.1:8000/sub/path/ and all document paths are offset accordingly.

","title":"Offset the local site root according to the sub-path of the site_url (#2424)"},{"location":"about/release-notes/#a-build_error-event-was-added-2103","text":"

Plugin developers can now use the on_build_error hook to execute code when an exception is raised while building the site.

See on_build_error in the Plugins documentation for details.

","title":"A build_error event was added (#2103)"},{"location":"about/release-notes/#three-new-exceptions-builderror-pluginerror-and-abort-2103","text":"

MkDocs now has tree new exceptions defined in mkdocs.exceptions: BuildError, PluginError, and Abort:

See Handling errors in the Plugins documentation for details.

","title":"Three new exceptions: BuildError PluginError and Abort (#2103)"},{"location":"about/release-notes/#search-indexing-strategy-configuration","text":"

Users can now specify which strategy they wish to use when indexing their site for search. A user can select between the following options:

See Search Indexing in the configuration documentation for details.

","title":"Search Indexing Strategy configuration"},{"location":"about/release-notes/#backward-incompatible-changes-in-12","text":"","title":"Backward Incompatible Changes in 1.2"},{"location":"about/release-notes/#other-changes-and-additions-to-version-12","text":"","title":"Other Changes and Additions to Version 1.2"},{"location":"about/release-notes/#version-112-2020-05-14","text":"","title":"Version 1.1.2 (2020-05-14)"},{"location":"about/release-notes/#version-111-2020-05-12","text":"","title":"Version 1.1.1 (2020-05-12)"},{"location":"about/release-notes/#version-11-2020-02-22","text":"","title":"Version 1.1 (2020-02-22)"},{"location":"about/release-notes/#major-additions-to-version-11","text":"","title":"Major Additions to Version 1.1"},{"location":"about/release-notes/#support-for-lunrpy-as-prebuild_index-engine","text":"

Mkdocs now supports pre-building indices using Lunr.py, a pure Python implementation of Lunr.js, allowing the user to avoid installing a NodeJS environment if so desired. For more information please read the prebuild_index documentation.

","title":"Support for Lunr.py as prebuild_index engine"},{"location":"about/release-notes/#readthedocs-theme-updated-with-upstream-588-and-1374","text":"

The readthedocs theme now more closely matches the upstream Sphinx theme (version 0.4.1). A number of new theme configuration settings were added which mirror the upstream configuration options. See the theme documentation for details.

","title":"readthedocs theme updated with upstream (#588 and #1374)"},{"location":"about/release-notes/#update-mkdocs-theme-to-bootswatch-413-1563","text":"

The mkdocs theme now supports all the features of Bootswatch 4.1. Additionally, 2 filenames were changed in this update. If you are using a theme which inherits from the mkdocs theme, the theme developer may need to update these filenames as follows.

css/bootstrap-custom.min.css => css/bootstrap.min.css\njs/bootstrap-3.0.3.min.js => js/bootstrap.min.js
","title":"Update mkdocs theme to Bootswatch 4.1.3 (#1563)"},{"location":"about/release-notes/#improved-configuration-support-on-the-command-line-1401","text":"

The build, serve, and gh-deploy subcommands now support flags to control whether directory URLs should be created: --use-directory-urls / --no-directory-urls. In addition, the gh-deploy subcommand now supports all the configuration options that build and serve do, adding --strict, --theme, --theme-dir, and --site-dir.

","title":"Improved configuration support on the command line (#1401)"},{"location":"about/release-notes/#updated-lunr-languages-support-1729","text":"

The lunr-languages plugin has been updated to 1.4.0, adding support for Arabic (ar) and Vietnamese (vi) languages. In addition, the Dutch and Japanese language codes have been changed to their standard values: nl and ja, respectively. The old language codes (du and jp) remain as aliases but may be removed in a future version of MkDocs.

","title":"Updated lunr-languages support (#1729)"},{"location":"about/release-notes/#other-changes-and-additions-to-version-11","text":"","title":"Other Changes and Additions to Version 1.1"},{"location":"about/release-notes/#version-104-2018-09-07","text":"","title":"Version 1.0.4 (2018-09-07)"},{"location":"about/release-notes/#version-103-2018-08-29","text":"","title":"Version 1.0.3 (2018-08-29)"},{"location":"about/release-notes/#version-102-2018-08-22","text":"","title":"Version 1.0.2 (2018-08-22)"},{"location":"about/release-notes/#version-101-2018-08-13","text":"","title":"Version 1.0.1 (2018-08-13)"},{"location":"about/release-notes/#version-10-2018-08-03","text":"","title":"Version 1.0 (2018-08-03)"},{"location":"about/release-notes/#major-additions-to-version-10","text":"","title":"Major Additions to Version 1.0"},{"location":"about/release-notes/#internal-refactor-of-pages-files-and-navigation","text":"

Internal handling of pages, files and navigation has been completely refactored. The changes included in the refactor are summarized below.

","title":"Internal Refactor of Pages, Files, and Navigation"},{"location":"about/release-notes/#backward-incompatible-changes","text":"

As part of the internal refactor, a number of backward incompatible changes have been introduced, which are summarized below.

","title":"Backward Incompatible Changes"},{"location":"about/release-notes/#urls-have-changed-when-use_directory_urls-is-false","text":"

Previously, all Markdown pages would be have their filenames altered to be index pages regardless of how the use_directory_urls setting was configured. However, the path munging is only needed when use_directory_urls is set to True (the default). The path mangling no longer happens when use_directory_urls is set to False, which will result in different URLs for all pages that were not already index files. As this behavior only effects a non-default configuration, and the most common user-case for setting the option to False is for local file system (file://) browsing, its not likely to effect most users. However, if you have use_directory_urls set to False for a MkDocs site hosted on a web server, most of your URLs will now be broken. As you can see below, the new URLs are much more sensible.

Markdown file Old URL New URL index.md index.html index.html foo.md foo/index.html foo.html foo/bar.md foo/bar/index.html foo/bar.html

Note that there has been no change to URLs or file paths when use_directory_urls is set to True (the default), except that MkDocs more consistently includes an ending slash on all internally generated URLs.

","title":"URLs have changed when use_directory_urls is False"},{"location":"about/release-notes/#the-pages-configuration-setting-has-been-renamed-to-nav","text":"

The pages configuration setting is deprecated and will issue a warning if set in the configuration file. The setting has been renamed nav. To update your configuration, simply rename the setting to nav. In other words, if your configuration looked like this:

pages:\n    - Home: index.md\n    - User Guide: user-guide.md

Simply edit the configuration as follows:

nav:\n    - Home: index.md\n    - User Guide: user-guide.md

In the current release, any configuration which includes a pages setting, but no nav setting, the pages configuration will be copied to nav and a warning will be issued. However, in a future release, that may no longer happen. If both pages and nav are defined, the pages setting will be ignored.

","title":"The pages configuration setting has been renamed to nav"},{"location":"about/release-notes/#template-variables-and-base_url","text":"

In previous versions of MkDocs some URLs expected the base_url template variable to be prepended to the URL and others did not. That inconsistency has been removed in that no URLs are modified before being added to the template context.

For example, a theme template might have previously included a link to the site_name as:

<a href=\"{{ nav.homepage.url }}\">{{ config.site_name }}</a>

And MkDocs would magically return a URL for the homepage which was relative to the current page. That \"magic\" has been removed and the url template filter should be used:

<a href=\"{{ nav.homepage.url|url }}\">{{ config.site_name }}</a>

This change applies to any navigation items and pages, as well as the page.next_page and page.previous_page attributes. For the time being, the extra_javascript and extra_css variables continue to work as previously (without the url template filter), but they have been deprecated and the corresponding configuration values (config.extra_javascript and config.extra_css respectively) should be used with the filter instead.

{% for path in config['extra_css'] %}\n    <link href=\"{{ path|url }}\" rel=\"stylesheet\">\n{% endfor %}

Note that navigation can now include links to external sites. Obviously, the base_url should not be prepended to these items. However, the url template filter is smart enough to recognize the URL is absolute and does not alter it. Therefore, all navigation items can be passed to the filter and only those that need to will be altered.

{% for nav_item in nav %}\n    <a href=\"{{ nav_item.url|url }}\">{{ nav_item.title }}</a>\n{% endfor %}
","title":"Template variables and base_url"},{"location":"about/release-notes/#path-based-settings-are-relative-to-configuration-file-543","text":"

Previously any relative paths in the various configuration options were resolved relative to the current working directory. They are now resolved relative to the configuration file. As the documentation has always encouraged running the various MkDocs commands from the directory that contains the configuration file (project root), this change will not affect most users. However, it will make it much easier to implement automated builds or otherwise run commands from a location other than the project root.

Simply use the -f/--config-file option and point it at the configuration file:

mkdocs build --config-file /path/to/my/config/file.yml

As previously, if no file is specified, MkDocs looks for a file named mkdocs.yml in the current working directory.

","title":"Path Based Settings are Relative to Configuration File (#543)"},{"location":"about/release-notes/#added-support-for-yaml-meta-data-1542","text":"

Previously, MkDocs only supported MultiMarkdown style meta-data, which does not recognize different data types and is rather limited. MkDocs now also supports YAML style meta-data in Markdown documents. MkDocs relies on the the presence or absence of the deliminators (--- or ...) to determine whether YAML style meta-data or MultiMarkdown style meta-data is being used.

Previously MkDocs would recognize MultiMarkdown style meta-data between the deliminators. Now, if the deliminators are detected, but the content between the deliminators is not valid YAML meta-data, MkDocs does not attempt to parse the content as MultiMarkdown style meta-data. Therefore, MultiMarkdown's style meta-data must not include the deliminators. See the MultiMarkdown style meta-data documentation for details.

Prior to version 0.17, MkDocs returned all meta-data values as a list of strings (even a single line would return a list of one string). In version 0.17, that behavior was changed to return each value as a single string (multiple lines were joined), which some users found limiting (see #1471). That behavior continues for MultiMarkdown style meta-data in the current version. However, YAML style meta-data supports the full range of \"safe\" YAML data types. Therefore, it is recommended that any complex meta-data make use of the YAML style (see the YAML style meta-data documentation for details). In fact, a future version of MkDocs may deprecate support for MultiMarkdown style meta-data.

","title":"Added support for YAML Meta-Data (#1542)"},{"location":"about/release-notes/#refactor-search-plugin","text":"

The search plugin has been completely refactored to include support for the following features:

Users can review the configuration options available and theme authors should review how search and themes interact.

","title":"Refactor Search Plugin"},{"location":"about/release-notes/#theme_dir-configuration-option-fully-deprecated","text":"

As of version 0.17, the custom_dir option replaced the deprecated theme_dir option. If users had set the theme_dir option, MkDocs version 0.17 copied the value to the theme.custom_dir option and a warning was issued. As of version 1.0, the value is no longer copied and an error is raised.

","title":"theme_dir Configuration Option fully Deprecated"},{"location":"about/release-notes/#other-changes-and-additions-to-version-10","text":"","title":"Other Changes and Additions to Version 1.0"},{"location":"about/release-notes/#version-0175-2018-07-06","text":"","title":"Version 0.17.5 (2018-07-06)"},{"location":"about/release-notes/#version-0174-2018-06-08","text":"","title":"Version 0.17.4 (2018-06-08)"},{"location":"about/release-notes/#version-0173-2018-03-07","text":"","title":"Version 0.17.3 (2018-03-07)"},{"location":"about/release-notes/#version-0172-2017-11-15","text":"","title":"Version 0.17.2 (2017-11-15)"},{"location":"about/release-notes/#version-0171-2017-10-30","text":"","title":"Version 0.17.1 (2017-10-30)"},{"location":"about/release-notes/#version-0170-2017-10-19","text":"","title":"Version 0.17.0 (2017-10-19)"},{"location":"about/release-notes/#major-additions-to-version-0170","text":"","title":"Major Additions to Version 0.17.0"},{"location":"about/release-notes/#plugin-api-206","text":"

A new Plugin API has been added to MkDocs which allows users to define their own custom behaviors. See the included documentation for a full explanation of the API.

The previously built-in search functionality has been removed and wrapped in a plugin (named \"search\") with no changes in behavior. When MkDocs builds, the search index is now written to search/search_index.json instead of mkdocs/search_index.json. If no plugins setting is defined in the config, then the search plugin will be included by default. See the configuration documentation for information on overriding the default.

","title":"Plugin API. (#206)"},{"location":"about/release-notes/#theme-customization-1164","text":"

Support had been added to provide theme specific customizations. Theme authors can define default options as documented in Theme Configuration. A theme can now inherit from another theme, define various static templates to be rendered, and define arbitrary default variables to control behavior in the templates. The theme configuration is defined in a configuration file named mkdocs_theme.yml which should be placed at the root of your template files. A warning will be raised if no configuration file is found and an error will be raised in a future release.

Users can override those defaults under the theme configuration option of their mkdocs.yml configuration file, which now accepts nested options. One such nested option is the custom_dir option, which replaces the now deprecated theme_dir option. If users had previously set the theme_dir option, a warning will be issued, with an error expected in a future release.

If a configuration previously defined a theme_dir like this:

theme: mkdocs\ntheme_dir: custom

Then the configuration should be adjusted as follows:

theme:\n    name: mkdocs\n    custom_dir: custom

See the theme configuration option documentation for details.

","title":"Theme Customization. (#1164)"},{"location":"about/release-notes/#previously-deprecated-template-variables-removed-1168","text":"","title":"Previously deprecated Template variables removed. (#1168)"},{"location":"about/release-notes/#page-template","text":"

The primary entry point for page templates has been changed from base.html to main.html. This allows base.html to continue to exist while allowing users to override main.html and extend base.html. For version 0.16, base.html continued to work if no main.html template existed, but it raised a deprecation warning. In version 1.0, a build will fail if no main.html template exists.

","title":"Page Template"},{"location":"about/release-notes/#context-variables","text":"

Page specific variable names in the template context have been refactored as defined in Custom Themes. The old variable names issued a warning in version 0.16, but have been removed in version 1.0.

Any of the following old page variables should be updated to the new ones in user created and third-party templates:

Old Variable Name New Variable Name current_page page page_title page.title content page.content toc page.toc meta page.meta canonical_url page.canonical_url previous_page page.previous_page next_page page.next_page

Additionally, a number of global variables have been altered and/or removed and user created and third-party templates should be updated as outlined below:

Old Variable Name New Variable Name or Expression current_page page include_nav nav|length>1 include_next_prev (page.next_page or page.previous_page) site_name config.site_name site_author config.site_author page_description config.site_description repo_url config.repo_url repo_name config.repo_name site_url config.site_url copyright config.copyright google_analytics config.google_analytics homepage_url nav.homepage.url favicon {{ base_url }}/img/favicon.ico","title":"Context Variables"},{"location":"about/release-notes/#auto-populated-extra_css-and-extra_javascript-fully-deprecated-986","text":"

In previous versions of MkDocs, if the extra_css or extra_javascript config settings were empty, MkDocs would scan the docs_dir and auto-populate each setting with all of the CSS and JavaScript files found. On version 0.16 this behavior was deprecated and a warning was issued. In 0.17 any unlisted CSS and JavaScript files will not be included in the HTML templates, however, a warning will be issued. In other words, they will still be copied to the site-dir, but they will not have any effect on the theme if they are not explicitly listed.

All CSS and JavaScript files in the docs_dir should be explicitly listed in the extra_css or extra_javascript config settings going forward.

","title":"Auto-Populated extra_css and extra_javascript Fully Deprecated. (#986)"},{"location":"about/release-notes/#other-changes-and-additions-to-version-0170","text":"","title":"Other Changes and Additions to Version 0.17.0"},{"location":"about/release-notes/#version-0163-2017-04-04","text":"","title":"Version 0.16.3 (2017-04-04)"},{"location":"about/release-notes/#version-0162-2017-03-13","text":"","title":"Version 0.16.2 (2017-03-13)"},{"location":"about/release-notes/#version-0161-2016-12-22","text":"","title":"Version 0.16.1 (2016-12-22)"},{"location":"about/release-notes/#version-016-2016-11-04","text":"","title":"Version 0.16 (2016-11-04)"},{"location":"about/release-notes/#major-additions-to-version-0160","text":"","title":"Major Additions to Version 0.16.0"},{"location":"about/release-notes/#template-variables-refactored-874","text":"","title":"Template variables refactored. (#874)"},{"location":"about/release-notes/#page-context","text":"

Page specific variable names in the template context have been refactored as defined in Custom Themes. The old variable names will issue a warning but continue to work for version 0.16, but may be removed in a future version.

Any of the following old page variables should be updated to the new ones in user created and third-party templates:

Old Variable Name New Variable Name current_page page page_title page.title content page.content toc page.toc meta page.meta canonical_url page.canonical_url previous_page page.previous_page next_page page.next_page","title":"Page Context"},{"location":"about/release-notes/#global-context","text":"

Additionally, a number of global variables have been altered and/or deprecated and user created and third-party templates should be updated as outlined below:

Previously, the global variable include_nav was altered programmatically based on the number of pages in the nav. The variable will issue a warning but continue to work for version 0.16, but may be removed in a future version. Use {% if nav|length>1 %} instead.

Previously, the global variable include_next_prev was altered programmatically based on the number of pages in the nav. The variable will issue a warning but continue to work for version 0.16, but may be removed in a future version. Use {% if page.next_page or page.previous_page %} instead.

Previously the global variable page_description was altered programmatically based on whether the current page was the homepage. Now it simply maps to config['site_description']. Use {% if page.is_homepage %} in the template to conditionally change the description.

The global variable homepage_url maps directly to nav.homepage.url and is being deprecated. The variable will issue a warning but continue to work for version 0.16, but may be removed in a future version. Use nav.homepage.url instead.

The global variable favicon maps to the configuration setting site_favicon. Both the template variable and the configuration setting are being deprecated and will issue a warning but continue to work for version 0.16, and may be removed in a future version. Use {{ base_url }}/img/favicon.ico in your template instead. Users can simply save a copy of their custom favicon icon to img/favicon.ico in either their docs_dir or theme_dir.

A number of variables map directly to similarly named variables in the config. Those variables are being deprecated and will issue a warning but continue to work for version 0.16, but may be removed in a future version. Use config.var_name instead, where var_name is the name of one of the configuration variables.

Below is a summary of all of the changes made to the global context:

Old Variable Name New Variable Name or Expression current_page page include_nav nav|length>1 include_next_prev (page.next_page or page.previous_page) site_name config.site_name site_author config.site_author page_description config.site_description repo_url config.repo_url repo_name config.repo_name site_url config.site_url copyright config.copyright google_analytics config.google_analytics homepage_url nav.homepage.url favicon {{ base_url }}/img/favicon.ico","title":"Global Context"},{"location":"about/release-notes/#increased-template-customization-607","text":"

The built-in themes have been updated by having each of their many parts wrapped in template blocks which allow each individual block to be easily overridden using the theme_dir config setting. Without any new settings, you can use a different analytics service, replace the default search function, or alter the behavior of the navigation, among other things. See the relevant documentation for more details.

To enable this feature, the primary entry point for page templates has been changed from base.html to main.html. This allows base.html to continue to exist while allowing users to override main.html and extend base.html. For version 0.16, base.html will continue to work if no main.html template exists, but it is deprecated and will raise a warning. In version 1.0, a build will fail if no main.html template exists. Any custom and third party templates should be updated accordingly.

The easiest way for a third party theme to be updated would be to simply add a main.html file which only contains the following line:

{% extends \"base.html\" %}

That way, the theme contains the main.html entry point, and also supports overriding blocks in the same manner as the built-in themes. Third party themes are encouraged to wrap the various pieces of their templates in blocks in order to support such customization.

","title":"Increased Template Customization. (#607)"},{"location":"about/release-notes/#auto-populated-extra_css-and-extra_javascript-deprecated-986","text":"

In previous versions of MkDocs, if the extra_css or extra_javascript config settings were empty, MkDocs would scan the docs_dir and auto-populate each setting with all of the CSS and JavaScript files found. This behavior is deprecated and a warning will be issued. In the next release, the auto-populate feature will stop working and any unlisted CSS and JavaScript files will not be included in the HTML templates. In other words, they will still be copied to the site-dir, but they will not have any effect on the theme if they are not explicitly listed.

All CSS and JavaScript files in the docs_dir should be explicitly listed in the extra_css or extra_javascript config settings going forward.

","title":"Auto-Populated extra_css and extra_javascript Deprecated. (#986)"},{"location":"about/release-notes/#support-for-dirty-builds-990","text":"

For large sites the build time required to create the pages can become problematic, thus a \"dirty\" build mode was created. This mode simply compares the modified time of the generated HTML and source markdown. If the markdown has changed since the HTML then the page is re-constructed. Otherwise, the page remains as is. This mode may be invoked in both the mkdocs serve and mkdocs build commands:

mkdocs serve --dirtyreload
mkdocs build --dirty

It is important to note that this method for building the pages is for development of content only, since the navigation and other links do not get updated on other pages.

","title":"Support for dirty builds. (#990)"},{"location":"about/release-notes/#stricter-directory-validation","text":"

Previously, a warning was issued if the site_dir was a child directory of the docs_dir. This now raises an error. Additionally, an error is now raised if the docs_dir is set to the directory which contains your config file rather than a child directory. You will need to rearrange you directory structure to better conform with the documented layout.

","title":"Stricter Directory Validation"},{"location":"about/release-notes/#other-changes-and-additions-to-version-0160","text":"","title":"Other Changes and Additions to Version 0.16.0"},{"location":"about/release-notes/#version-0153-2016-02-18","text":"","title":"Version 0.15.3 (2016-02-18)"},{"location":"about/release-notes/#version-0152-2016-02-08","text":"","title":"Version 0.15.2 (2016-02-08)"},{"location":"about/release-notes/#version-0151-2016-01-30","text":"","title":"Version 0.15.1 (2016-01-30)"},{"location":"about/release-notes/#version-0150-2016-01-21","text":"","title":"Version 0.15.0 (2016-01-21)"},{"location":"about/release-notes/#major-additions-to-version-0150","text":"","title":"Major Additions to Version 0.15.0"},{"location":"about/release-notes/#add-support-for-installable-themes","text":"

MkDocs now supports themes that are distributed via Python packages. With this addition, the Bootstrap and Bootswatch themes have been moved to external git repositories and python packages. See their individual documentation for more details about these specific themes.

They will be included with MkDocs by default until a future release. After that they will be installable with pip: pip install mkdocs-bootstrap and pip install mkdocs-bootswatch

See the documentation for Customizing Your Theme for more information about using and customizing themes and Custom themes for creating and distributing new themes

","title":"Add support for installable themes"},{"location":"about/release-notes/#other-changes-and-additions-to-version-0150","text":"","title":"Other Changes and Additions to Version 0.15.0"},{"location":"about/release-notes/#version-0140-2015-06-09","text":"","title":"Version 0.14.0 (2015-06-09)"},{"location":"about/release-notes/#version-0133-2015-06-02","text":"","title":"Version 0.13.3 (2015-06-02)"},{"location":"about/release-notes/#version-0132-2015-05-30","text":"","title":"Version 0.13.2 (2015-05-30)"},{"location":"about/release-notes/#version-0131-2015-05-27","text":"","title":"Version 0.13.1 (2015-05-27)"},{"location":"about/release-notes/#version-0130-2015-05-26","text":"","title":"Version 0.13.0 (2015-05-26)"},{"location":"about/release-notes/#deprecations-to-version-0130","text":"","title":"Deprecations to Version 0.13.0"},{"location":"about/release-notes/#deprecate-the-json-command","text":"

In this release the mkdocs json command has been marked as deprecated and when used a deprecation warning will be shown. It will be removed in a future release of MkDocs, version 1.0 at the latest. The mkdocs json command provided a convenient way for users to output the documentation contents as JSON files but with the additions of search to MkDocs this functionality is duplicated.

A new index with all the contents from a MkDocs build is created in the site_dir, so with the default value for the site_dir It can be found in site/mkdocs/search_index.json.

This new file is created on every MkDocs build (with mkdocs build) and no configuration is needed to enable it.

","title":"Deprecate the JSON command"},{"location":"about/release-notes/#change-the-pages-configuration","text":"

Provide a new way to define pages, and specifically nested pages, in the mkdocs.yml file and deprecate the existing approach, support will be removed with MkDocs 1.0.

","title":"Change the pages configuration"},{"location":"about/release-notes/#warn-users-about-the-removal-of-builtin-themes","text":"

All themes other than mkdocs and readthedocs will be moved into external packages in a future release of MkDocs. This will enable them to be more easily supported and updates outside MkDocs releases.

","title":"Warn users about the removal of builtin themes"},{"location":"about/release-notes/#major-additions-to-version-0130","text":"","title":"Major Additions to Version 0.13.0"},{"location":"about/release-notes/#search","text":"

Support for search has now been added to MkDocs. This is based on the JavaScript library lunr.js. It has been added to both the mkdocs and readthedocs themes. See the custom theme documentation on supporting search for adding it to your own themes.

","title":"Search"},{"location":"about/release-notes/#new-command-line-interface","text":"

The command line interface for MkDocs has been re-written with the Python library Click. This means that MkDocs now has an easier to use interface with better help output.

This change is partially backwards incompatible as while undocumented it was possible to pass any configuration option to the different commands. Now only a small subset of the configuration options can be passed to the commands. To see in full commands and available arguments use mkdocs --help and mkdocs build --help to have them displayed.

","title":"New Command Line Interface"},{"location":"about/release-notes/#support-extra-html-and-xml-files","text":"

Like the extra_javascript and extra_css configuration options, a new option named extra_templates has been added. This will automatically be populated with any .html or .xml files in the project docs directory.

Users can place static HTML and XML files and they will be copied over, or they can also use Jinja2 syntax and take advantage of the global variables.

By default MkDocs will use this approach to create a sitemap for the documentation.

","title":"Support Extra HTML and XML files"},{"location":"about/release-notes/#other-changes-and-additions-to-version-0130","text":"","title":"Other Changes and Additions to Version 0.13.0"},{"location":"about/release-notes/#version-0122-2015-04-22","text":"","title":"Version 0.12.2 (2015-04-22)"},{"location":"about/release-notes/#version-0121-2015-04-14","text":"","title":"Version 0.12.1 (2015-04-14)"},{"location":"about/release-notes/#version-0120-2015-04-14","text":"","title":"Version 0.12.0 (2015-04-14)"},{"location":"about/release-notes/#version-0111-2014-11-20","text":"","title":"Version 0.11.1 (2014-11-20)"},{"location":"about/release-notes/#version-0110-2014-11-18","text":"","title":"Version 0.11.0 (2014-11-18)"},{"location":"about/release-notes/#version-0100-2014-10-29","text":"","title":"Version 0.10.0 (2014-10-29)"},{"location":"dev-guide/","text":"

Extending MkDocs

The MkDocs Developer Guide provides documentation for developers of third party themes and plugins. Please see the Contributing Guide for information on contributing to MkDocs itself. You can jump directly to a page listed below, or use the next and previous buttons in the navigation bar at the top of the page to move through the documentation in order.

","title":"Developer Guide"},{"location":"dev-guide/api/","text":"

Note

The main entry point to the API is through Events that are received by plugins. These events' descriptions link back to this page.

","title":"API reference"},{"location":"dev-guide/api/#mkdocs.structure.files.Files","text":"

A collection of File objects.

","title":"mkdocs.structure.files.Files"},{"location":"dev-guide/api/#mkdocs.structure.files.Files.__iter__","text":"

Iterate over the files within.

","title":"__iter__() -> Iterator[File]"},{"location":"dev-guide/api/#mkdocs.structure.files.Files.__len__","text":"

The number of files within.

","title":"__len__() -> int"},{"location":"dev-guide/api/#mkdocs.structure.files.Files.__contains__","text":"

Whether the file with this src_uri is in the collection.

","title":"__contains__(path: str) -> bool"},{"location":"dev-guide/api/#mkdocs.structure.files.Files.src_paths","text":"

Soft-deprecated, prefer src_uris.

","title":"src_paths() -> Dict[str, File] property"},{"location":"dev-guide/api/#mkdocs.structure.files.Files.src_uris","text":"

A mapping containing every file, with the keys being their src_uri.

","title":"src_uris() -> Dict[str, File] property"},{"location":"dev-guide/api/#mkdocs.structure.files.Files.get_file_from_path","text":"

Return a File instance with File.src_uri equal to path.

","title":"get_file_from_path(path: str) -> Optional[File]"},{"location":"dev-guide/api/#mkdocs.structure.files.Files.append","text":"

Append file to Files collection.

","title":"append(file: File) -> None"},{"location":"dev-guide/api/#mkdocs.structure.files.Files.remove","text":"

Remove file from Files collection.

","title":"remove(file: File) -> None"},{"location":"dev-guide/api/#mkdocs.structure.files.Files.copy_static_files","text":"

Copy static files from source to destination.

","title":"copy_static_files(dirty: bool = False) -> None"},{"location":"dev-guide/api/#mkdocs.structure.files.Files.documentation_pages","text":"

Return iterable of all Markdown page file objects.

","title":"documentation_pages() -> Sequence[File]"},{"location":"dev-guide/api/#mkdocs.structure.files.Files.static_pages","text":"

Return iterable of all static page file objects.

","title":"static_pages() -> Sequence[File]"},{"location":"dev-guide/api/#mkdocs.structure.files.Files.media_files","text":"

Return iterable of all file objects which are not documentation or static pages.

","title":"media_files() -> Sequence[File]"},{"location":"dev-guide/api/#mkdocs.structure.files.Files.javascript_files","text":"

Return iterable of all javascript file objects.

","title":"javascript_files() -> Sequence[File]"},{"location":"dev-guide/api/#mkdocs.structure.files.Files.css_files","text":"

Return iterable of all CSS file objects.

","title":"css_files() -> Sequence[File]"},{"location":"dev-guide/api/#mkdocs.structure.files.Files.add_files_from_theme","text":"

Retrieve static files from Jinja environment and add to collection.

","title":"add_files_from_theme(env: jinja2.Environment, config: MkDocsConfig) -> None"},{"location":"dev-guide/api/#mkdocs.structure.files.File","text":"

A MkDocs File object.

Points to the source and destination locations of a file.

The path argument must be a path that exists relative to src_dir.

The src_dir and dest_dir must be absolute paths on the local file system.

The use_directory_urls argument controls how destination paths are generated. If False, a Markdown file is mapped to an HTML file of the same name (the file extension is changed to .html). If True, a Markdown file is mapped to an HTML index file (index.html) nested in a directory using the \"name\" of the file in path. The use_directory_urls argument has no effect on non-Markdown files.

File objects have the following properties, which are Unicode strings:

","title":"mkdocs.structure.files.File"},{"location":"dev-guide/api/#mkdocs.structure.files.File.src_uri","text":"

The pure path (always '/'-separated) of the source file relative to the source directory.

","title":"src_uri: str class-attribute"},{"location":"dev-guide/api/#mkdocs.structure.files.File.dest_path","text":"

Same as dest_uri (and synchronized with it) but will use backslashes on Windows. Discouraged.

","title":"dest_path() -> str property writable"},{"location":"dev-guide/api/#mkdocs.structure.files.File.url_relative_to","text":"

Return url for file relative to other file.

","title":"url_relative_to(other: File) -> str"},{"location":"dev-guide/api/#mkdocs.structure.files.File.copy_file","text":"

Copy source file to destination, ensuring parent directories exist.

","title":"copy_file(dirty: bool = False) -> None"},{"location":"dev-guide/api/#mkdocs.structure.files.File.is_documentation_page","text":"

Return True if file is a Markdown page.

","title":"is_documentation_page() -> bool"},{"location":"dev-guide/api/#mkdocs.structure.files.File.is_static_page","text":"

Return True if file is a static page (HTML, XML, JSON).

","title":"is_static_page() -> bool"},{"location":"dev-guide/api/#mkdocs.structure.files.File.is_media_file","text":"

Return True if file is not a documentation or static page.

","title":"is_media_file() -> bool"},{"location":"dev-guide/api/#mkdocs.structure.files.File.is_javascript","text":"

Return True if file is a JavaScript file.

","title":"is_javascript() -> bool"},{"location":"dev-guide/api/#mkdocs.structure.files.File.is_css","text":"

Return True if file is a CSS file.

","title":"is_css() -> bool"},{"location":"dev-guide/api/#mkdocs.config.base.Config","text":"

Bases: UserDict

Base class for MkDocs configuration, plugin configuration (and sub-configuration) objects.

It should be subclassed and have ConfigOptions defined as attributes. For examples, see mkdocs/contrib/search/init.py and mkdocs/config/defaults.py.

Behavior as it was prior to MkDocs 1.4 is now handled by LegacyConfig.

","title":"mkdocs.config.base.Config"},{"location":"dev-guide/api/#mkdocs.config.base.Config.__new__","text":"

Compatibility: allow referring to LegacyConfig(...) constructor as Config(...).

","title":"__new__(*args, **kwargs) -> Config"},{"location":"dev-guide/api/#mkdocs.config.base.Config.set_defaults","text":"

Set the base config by going through each validator and getting the default if it has one.

","title":"set_defaults() -> None"},{"location":"dev-guide/api/#mkdocs.config.base.Config.load_dict","text":"

Load config options from a dictionary.

","title":"load_dict(patch: Optional[dict]) -> None"},{"location":"dev-guide/api/#mkdocs.config.base.Config.load_file","text":"

Load config options from the open file descriptor of a YAML file.

","title":"load_file(config_file: IO) -> None"},{"location":"dev-guide/api/#mkdocs.livereload.LiveReloadServer","text":"

Bases: socketserver.ThreadingMixIn, wsgiref.simple_server.WSGIServer

","title":"mkdocs.livereload.LiveReloadServer"},{"location":"dev-guide/api/#mkdocs.livereload.LiveReloadServer.watch","text":"

Add the 'path' to watched paths, call the function and reload when any file changes under it.

","title":"watch(path: str, func: Optional[Callable] = None, recursive: bool = True) -> None"},{"location":"dev-guide/api/#mkdocs.livereload.LiveReloadServer.unwatch","text":"

Stop watching file changes for path. Raises if there was no corresponding watch call.

","title":"unwatch(path: str) -> None"},{"location":"dev-guide/plugins/","text":"

A Guide to installing, using and creating MkDocs Plugins

","title":"MkDocs Plugins"},{"location":"dev-guide/plugins/#installing-plugins","text":"

Before a plugin can be used, it must be installed on the system. If you are using a plugin which comes with MkDocs, then it was installed when you installed MkDocs. However, to install third party plugins, you need to determine the appropriate package name and install it using pip:

pip install mkdocs-foo-plugin

Once a plugin has been successfully installed, it is ready to use. It just needs to be enabled in the configuration file. The MkDocs Plugins wiki page has a growing list of plugins that you can install and use.

","title":"Installing Plugins"},{"location":"dev-guide/plugins/#using-plugins","text":"

The plugins configuration option should contain a list of plugins to use when building the site. Each \"plugin\" must be a string name assigned to the plugin (see the documentation for a given plugin to determine its \"name\"). A plugin listed here must already be installed.

plugins:\n    - search

Some plugins may provide configuration options of their own. If you would like to set any configuration options, then you can nest a key/value mapping (option_name: option value) of any options that a given plugin supports. Note that a colon (:) must follow the plugin name and then on a new line the option name and value must be indented and separated by a colon. If you would like to define multiple options for a single plugin, each option must be defined on a separate line.

plugins:\n    - search:\n        lang: en\n        foo: bar

For information regarding the configuration options available for a given plugin, see that plugin's documentation.

For a list of default plugins and how to override them, see the configuration documentation.

","title":"Using Plugins"},{"location":"dev-guide/plugins/#developing-plugins","text":"

Like MkDocs, plugins must be written in Python. It is generally expected that each plugin would be distributed as a separate Python module, although it is possible to define multiple plugins in the same module. At a minimum, a MkDocs Plugin must consist of a BasePlugin subclass and an entry point which points to it.

","title":"Developing Plugins"},{"location":"dev-guide/plugins/#baseplugin","text":"

A subclass of mkdocs.plugins.BasePlugin should define the behavior of the plugin. The class generally consists of actions to perform on specific events in the build process as well as a configuration scheme for the plugin.

All BasePlugin subclasses contain the following attributes:

","title":"BasePlugin"},{"location":"dev-guide/plugins/#config_scheme","text":"

A tuple of configuration validation instances. Each item must consist of a two item tuple in which the first item is the string name of the configuration option and the second item is an instance of mkdocs.config.config_options.BaseConfigOption or any of its subclasses.

For example, the following config_scheme defines three configuration options: foo, which accepts a string; bar, which accepts an integer; and baz, which accepts a boolean value.

class MyPlugin(mkdocs.plugins.BasePlugin):\n    config_scheme = (\n        ('foo', mkdocs.config.config_options.Type(str, default='a default value')),\n        ('bar', mkdocs.config.config_options.Type(int, default=0)),\n        ('baz', mkdocs.config.config_options.Type(bool, default=True))\n    )

New in version 1.4

","title":"config_scheme"},{"location":"dev-guide/plugins/#subclassing-config-to-specify-the-config-schema","text":"

To get type safety benefits, if you're targeting only MkDocs 1.4+, define the config schema as a class instead:

class MyPluginConfig(mkdocs.config.base.Config):\n    foo = mkdocs.config.config_options.Type(str, default='a default value')\n    bar = mkdocs.config.config_options.Type(int, default=0)\n    baz = mkdocs.config.config_options.Type(bool, default=True)\n\nclass MyPlugin(mkdocs.plugins.BasePlugin[MyPluginConfig]):\n    ...
","title":"Subclassing Config to specify the config schema"},{"location":"dev-guide/plugins/#examples-of-config-definitions","text":"Example

from mkdocs.config import base, config_options as c\n\nclass _ValidationOptions(base.Config):\n    enable = c.Type(bool, default=True)\n    verbose = c.Type(bool, default=False)\n    skip_checks = c.ListOfItems(c.Choice(('foo', 'bar', 'baz')), default=[])\n\nclass MyPluginConfig(base.Config):\n    definition_file = c.File(exists=True)  # required\n    checksum_file = c.Optional(c.File(exists=True))  # can be None but must exist if specified\n    validation = c.SubConfig(_ValidationOptions)

From the user's point of view SubConfig is similar to Type(dict), it's just that it also retains full ability for validation: you define all valid keys and what each value should adhere to.

And ListOfItems is similar to Type(list), but again, we define the constraint that each value must adhere to.

This accepts a config as follows:

my_plugin:\n  definition_file: configs/test.ini  # relative to mkdocs.yml\n  validation:\n    enable: !ENV [CI, false]\n    verbose: true\n    skip_checks:\n      - foo\n      - baz
Example

import numbers\nfrom mkdocs.config import base, config_options as c\n\nclass _Rectangle(base.Config):\n    width = c.Type(numbers.Real)  # required\n    height = c.Type(numbers.Real)  # required\n\nclass MyPluginConfig(base.Config):\n    add_rectangles = c.ListOfItems(c.SubConfig(_Rectangle))  # required

In this example we define a list of complex items, and that's achieved by passing a concrete SubConfig to ListOfItems.

This accepts a config as follows:

my_plugin:\n  add_rectangles:\n    - width: 5\n      height: 7\n    - width: 12\n      height: 2

When the user's configuration is loaded, the above scheme will be used to validate the configuration and fill in any defaults for settings not provided by the user. The validation classes may be any of the classes provided in mkdocs.config.config_options or a third party subclass defined in the plugin.

Any settings provided by the user which fail validation or are not defined in the config_scheme will raise a mkdocs.config.base.ValidationError.

","title":"Examples of config definitions"},{"location":"dev-guide/plugins/#config","text":"

A dictionary of configuration options for the plugin, which is populated by the load_config method after configuration validation has completed. Use this attribute to access options provided by the user.

def on_pre_build(self, config, **kwargs):\n    if self.config['baz']:\n        # implement \"baz\" functionality here...

New in version 1.4

","title":"config"},{"location":"dev-guide/plugins/#safe-attribute-based-access","text":"

To get type safety benefits, if you're targeting only MkDocs 1.4+, access options as attributes instead:

def on_pre_build(self, config, **kwargs):\n    if self.config.baz:\n        print(self.config.bar ** 2)  # OK, `int ** 2` is valid.

All BasePlugin subclasses contain the following method(s):

","title":"Safe attribute-based access"},{"location":"dev-guide/plugins/#load_configoptions","text":"

Loads configuration from a dictionary of options. Returns a tuple of (errors, warnings). This method is called by MkDocs during configuration validation and should not need to be called by the plugin.

","title":"load_config(options)"},{"location":"dev-guide/plugins/#on_event_name","text":"

Optional methods which define the behavior for specific events. The plugin should define its behavior within these methods. Replace <event_name> with the actual name of the event. For example, the pre_build event would be defined in the on_pre_build method.

Most events accept one positional argument and various keyword arguments. It is generally expected that the positional argument would be modified (or replaced) by the plugin and returned. If nothing is returned (the method returns None), then the original, unmodified object is used. The keyword arguments are simply provided to give context and/or supply data which may be used to determine how the positional argument should be modified. It is good practice to accept keyword arguments as **kwargs. In the event that additional keywords are provided to an event in a future version of MkDocs, there will be no need to alter your plugin.

For example, the following event would add an additional static_template to the theme config:

class MyPlugin(BasePlugin):\n    def on_config(self, config, **kwargs):\n        config['theme'].static_templates.add('my_template.html')\n        return config

New in version 1.4

To get type safety benefits, if you're targeting only MkDocs 1.4+, access config options as attributes instead:

def on_config(self, config: MkDocsConfig):\n    config.theme.static_templates.add('my_template.html')\n        return config
","title":"on_<event_name>()"},{"location":"dev-guide/plugins/#events","text":"

There are three kinds of events: Global Events, Page Events and Template Events.

See a diagram with relations between all the plugin events