mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Updated documentation
This commit is contained in:
parent
6acd637cb8
commit
6af95f942d
@ -499,7 +499,7 @@ digit `\d`, which leaves version numbers discoverable. Searching for
|
|||||||
[:octicons-search-24: 7.2.6][28] brings up the [7.2.6][29] release notes.
|
[:octicons-search-24: 7.2.6][28] brings up the [7.2.6][29] release notes.
|
||||||
|
|
||||||
[28]: ?q=7.2.6
|
[28]: ?q=7.2.6
|
||||||
[29]: ../../changelog.md#726-_-september-1-2021
|
[29]: ../../changelog/index.md#726-_-september-1-2021
|
||||||
|
|
||||||
#### HTML/XML tags
|
#### HTML/XML tags
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ template: overrides/main.html
|
|||||||
|
|
||||||
# Creating your site
|
# Creating your site
|
||||||
|
|
||||||
After you've [installed][1] Material for MkDocs, you can bootstrap your project
|
After you've [installed] Material for MkDocs, you can bootstrap your project
|
||||||
documentation using the `mkdocs` executable. Go to the directory where you want
|
documentation using the `mkdocs` executable. Go to the directory where you want
|
||||||
your project to be located and enter:
|
your project to be located and enter:
|
||||||
|
|
||||||
@ -35,14 +35,14 @@ This will create the following structure:
|
|||||||
└─ mkdocs.yml
|
└─ mkdocs.yml
|
||||||
```
|
```
|
||||||
|
|
||||||
[1]: getting-started.md
|
[installed]: getting-started.md
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
### Minimal configuration
|
### Minimal configuration
|
||||||
|
|
||||||
Simply add the following lines to `mkdocs.yml` to enable the theme. Note that
|
Simply add the following lines to `mkdocs.yml` to enable the theme. Note that
|
||||||
since there are several [installation methods][2], configuration might be
|
since there are several [installation methods], minimal configuration might be
|
||||||
slightly different:
|
slightly different:
|
||||||
|
|
||||||
=== "pip, docker"
|
=== "pip, docker"
|
||||||
@ -77,53 +77,53 @@ slightly different:
|
|||||||
logo: logo
|
logo: logo
|
||||||
```
|
```
|
||||||
|
|
||||||
_If you cloned Material for MkDocs from GitHub, you must list all of the themes'
|
When you clone from GitHub, you must list all of the themes' defaults
|
||||||
defaults, because_ [`mkdocs_theme.yml`][3] _is not loaded automatically as
|
explicitly, because [`mkdocs_theme.yml`][mkdocs_theme.yml] is not
|
||||||
[described in the official documentation][4]._
|
loaded automatically as described in the [custom theme guide].
|
||||||
|
|
||||||
[2]: getting-started.md#installation
|
[installation methods]: getting-started.md#installation
|
||||||
[3]: https://github.com/squidfunk/mkdocs-material/blob/master/src/mkdocs_theme.yml
|
[mkdocs_theme.yml]: https://github.com/squidfunk/mkdocs-material/blob/master/src/mkdocs_theme.yml
|
||||||
[4]: https://www.mkdocs.org/user-guide/custom-themes/#creating-a-custom-theme
|
[custom theme guide]: https://www.mkdocs.org/user-guide/custom-themes/#creating-a-custom-theme
|
||||||
|
|
||||||
### Advanced configuration
|
### Advanced configuration
|
||||||
|
|
||||||
Material for MkDocs comes with many configuration options. The _setup_ section
|
Material for MkDocs comes with many configuration options. The setup section
|
||||||
explains in great detail how to configure and customize colors, fonts, icons
|
explains in great detail how to configure and customize colors, fonts, icons
|
||||||
and much more:
|
and much more:
|
||||||
|
|
||||||
<div class="mdx-columns" markdown>
|
<div class="mdx-columns" markdown>
|
||||||
|
|
||||||
- [Changing the colors][5]
|
- [Changing the colors]
|
||||||
- [Changing the fonts][6]
|
- [Changing the fonts]
|
||||||
- [Changing the language][7]
|
- [Changing the language]
|
||||||
- [Changing the logo and icons][8]
|
- [Changing the logo and icons]
|
||||||
- [Setting up navigation][9]
|
- [Setting up navigation]
|
||||||
- [Setting up site search][10]
|
- [Setting up site search]
|
||||||
- [Setting up site analytics][11]
|
- [Setting up site analytics]
|
||||||
- [Setting up social cards][12]
|
- [Setting up social cards]
|
||||||
- [Setting up tags][13]
|
- [Setting up tags]
|
||||||
- [Setting up versioning][14]
|
- [Setting up versioning]
|
||||||
- [Setting up the header][15]
|
- [Setting up the header]
|
||||||
- [Setting up the footer][16]
|
- [Setting up the footer]
|
||||||
- [Adding a git repository][17]
|
- [Adding a git repository]
|
||||||
- [Adding a comment system][18]
|
- [Adding a comment system]
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
[5]: setup/changing-the-colors.md
|
[Changing the colors]: setup/changing-the-colors.md
|
||||||
[6]: setup/changing-the-fonts.md
|
[Changing the fonts]: setup/changing-the-fonts.md
|
||||||
[7]: setup/changing-the-language.md
|
[Changing the language]: setup/changing-the-language.md
|
||||||
[8]: setup/changing-the-logo-and-icons.md
|
[Changing the logo and icons]: setup/changing-the-logo-and-icons.md
|
||||||
[9]: setup/setting-up-navigation.md
|
[Setting up navigation]: setup/setting-up-navigation.md
|
||||||
[10]: setup/setting-up-site-search.md
|
[Setting up site search]: setup/setting-up-site-search.md
|
||||||
[11]: setup/setting-up-site-analytics.md
|
[Setting up site analytics]: setup/setting-up-site-analytics.md
|
||||||
[12]: setup/setting-up-social-cards.md
|
[Setting up social cards]: setup/setting-up-social-cards.md
|
||||||
[13]: setup/setting-up-tags.md
|
[Setting up tags]: setup/setting-up-tags.md
|
||||||
[14]: setup/setting-up-versioning.md
|
[Setting up versioning]: setup/setting-up-versioning.md
|
||||||
[15]: setup/setting-up-the-header.md
|
[Setting up the header]: setup/setting-up-the-header.md
|
||||||
[16]: setup/setting-up-the-footer.md
|
[Setting up the footer]: setup/setting-up-the-footer.md
|
||||||
[17]: setup/adding-a-git-repository.md
|
[Adding a git repository]: setup/adding-a-git-repository.md
|
||||||
[18]: setup/adding-a-comment-system.md
|
[Adding a comment system]: setup/adding-a-comment-system.md
|
||||||
|
|
||||||
## Previewing as you write
|
## Previewing as you write
|
||||||
|
|
||||||
@ -149,12 +149,12 @@ If you're running Material for MkDocs from within Docker, use:
|
|||||||
docker run --rm -it -p 8000:8000 -v "%cd%":/docs squidfunk/mkdocs-material
|
docker run --rm -it -p 8000:8000 -v "%cd%":/docs squidfunk/mkdocs-material
|
||||||
```
|
```
|
||||||
|
|
||||||
Point your browser to [localhost:8000][19] and you should see:
|
Point your browser to [localhost:8000][live preview] and you should see:
|
||||||
|
|
||||||
[![Creating your site][20]][20]
|
[![Creating your site]][Creating your site]
|
||||||
|
|
||||||
[19]: http://localhost:8000
|
[live preview]: http://localhost:8000
|
||||||
[20]: assets/screenshots/creating-your-site.png
|
[Creating your site]: assets/screenshots/creating-your-site.png
|
||||||
|
|
||||||
## Building your site
|
## Building your site
|
||||||
|
|
||||||
@ -167,8 +167,8 @@ mkdocs build
|
|||||||
|
|
||||||
The contents of this directory make up your project documentation. There's no
|
The contents of this directory make up your project documentation. There's no
|
||||||
need for operating a database or server, as it is completely self-contained.
|
need for operating a database or server, as it is completely self-contained.
|
||||||
The site can be hosted on [GitHub Pages][21], [GitLab Pages][22], a CDN of your
|
The site can be hosted on [GitHub Pages], [GitLab Pages], a CDN of your choice
|
||||||
choice or your private web space.
|
or your private web space.
|
||||||
|
|
||||||
[21]: publishing-your-site.md#github-pages
|
[GitHub Pages]: publishing-your-site.md#github-pages
|
||||||
[22]: publishing-your-site.md#gitlab-pages
|
[GitLab pages]: publishing-your-site.md#gitlab-pages
|
||||||
|
@ -11,11 +11,11 @@ necessary to preserve your brand's style.
|
|||||||
|
|
||||||
## Adding assets
|
## Adding assets
|
||||||
|
|
||||||
[MkDocs][1] provides several ways to customize a theme. In order to make a few
|
[MkDocs] provides several ways to customize a theme. In order to make a few
|
||||||
tweaks to Material for MkDocs, you can just add your stylesheets and JavaScript
|
small tweaks to Material for MkDocs, you can just CSS and JavaScript files to
|
||||||
files to the `docs` directory.
|
the `docs` directory.
|
||||||
|
|
||||||
[1]: https://www.mkdocs.org
|
[MkDocs]: https://www.mkdocs.org
|
||||||
|
|
||||||
### Additional CSS
|
### Additional CSS
|
||||||
|
|
||||||
@ -31,23 +31,17 @@ new stylesheet file in the `docs` directory:
|
|||||||
└─ mkdocs.yml
|
└─ mkdocs.yml
|
||||||
```
|
```
|
||||||
|
|
||||||
Then, add the following line to `mkdocs.yml`:
|
Then, add the following lines to `mkdocs.yml`:
|
||||||
|
|
||||||
``` yaml
|
``` yaml
|
||||||
extra_css:
|
extra_css:
|
||||||
- stylesheets/extra.css
|
- stylesheets/extra.css
|
||||||
```
|
```
|
||||||
|
|
||||||
Spin up the [live preview server][2] and start typing your changes in your
|
|
||||||
additional style sheet file – you should see them almost instantly after saving.
|
|
||||||
|
|
||||||
[2]: creating-your-site.md#previewing-as-you-write
|
|
||||||
|
|
||||||
### Additional JavaScript
|
### Additional JavaScript
|
||||||
|
|
||||||
The same is true for additional JavaScript. If you want to integrate another
|
If you want to integrate another syntax highlighter or add some custom logic to
|
||||||
syntax highlighter or add some custom logic to your theme, create a new
|
your theme, create a new JavaScript file in the `docs` directory:
|
||||||
JavaScript file in the `docs` directory:
|
|
||||||
|
|
||||||
``` sh
|
``` sh
|
||||||
.
|
.
|
||||||
@ -57,30 +51,27 @@ JavaScript file in the `docs` directory:
|
|||||||
└─ mkdocs.yml
|
└─ mkdocs.yml
|
||||||
```
|
```
|
||||||
|
|
||||||
Then, add the following line to `mkdocs.yml`:
|
Then, add the following lines to `mkdocs.yml`:
|
||||||
|
|
||||||
``` yaml
|
``` yaml
|
||||||
extra_javascript:
|
extra_javascript:
|
||||||
- javascripts/extra.js
|
- javascripts/extra.js
|
||||||
```
|
```
|
||||||
|
|
||||||
Further assistance can be found in the [MkDocs documentation][3].
|
|
||||||
|
|
||||||
[3]: https://www.mkdocs.org/user-guide/styling-your-docs/#customizing-a-theme
|
|
||||||
|
|
||||||
## Extending the theme
|
## Extending the theme
|
||||||
|
|
||||||
If you want to alter the HTML source (e.g. add or remove some parts), you can
|
If you want to alter the HTML source (e.g. add or remove some parts), you can
|
||||||
extend the theme. MkDocs supports [theme extension][4], an easy way to override
|
extend the theme. MkDocs supports [theme extension], an easy way to override
|
||||||
parts of Material for MkDocs without forking from git. This ensures that you
|
parts of Material for MkDocs without forking from git. This ensures that you
|
||||||
can update to the latest version more easily.
|
can update to the latest version more easily.
|
||||||
|
|
||||||
[4]: https://www.mkdocs.org/user-guide/styling-your-docs/#using-the-theme-custom_dir
|
[theme extension]: https://www.mkdocs.org/user-guide/styling-your-docs/#using-the-theme-custom_dir
|
||||||
|
|
||||||
### Setup and theme structure
|
### Setup and theme structure
|
||||||
|
|
||||||
Enable Material for MkDocs as usual in `mkdocs.yml`, and create a new folder
|
Enable Material for MkDocs as usual in `mkdocs.yml`, and create a new folder
|
||||||
for `overrides` which you then reference using the `custom_dir` key:
|
for `overrides` which you then reference using the [`custom_dir`][custom_dir]
|
||||||
|
setting:
|
||||||
|
|
||||||
``` yaml
|
``` yaml
|
||||||
theme:
|
theme:
|
||||||
@ -90,16 +81,15 @@ theme:
|
|||||||
|
|
||||||
!!! warning "Theme extension prerequisites"
|
!!! warning "Theme extension prerequisites"
|
||||||
|
|
||||||
As the `custom_dir` variable is used for the theme extension process,
|
As the [`custom_dir`][custom_dir] setting is used for the theme extension
|
||||||
Material for MkDocs needs to be installed via `pip` and referenced with the
|
process, Material for MkDocs needs to be installed via `pip` and referenced
|
||||||
`name` parameter in `mkdocs.yml`. It will not work when cloning from `git`.
|
with the [`name`][name] setting in `mkdocs.yml`. It will not work when
|
||||||
|
cloning from `git`.
|
||||||
|
|
||||||
The structure in the `overrides` directory must mirror the directory structure
|
The structure in the `overrides` directory must mirror the directory structure
|
||||||
of the original theme, as any file in the `overrides` directory will replace the
|
of the original theme, as any file in the `overrides` directory will replace the
|
||||||
file with the same name which is part of the original theme. Besides, further
|
file with the same name which is part of the original theme. Besides, further
|
||||||
assets may also be put in the `overrides` directory.
|
assets may also be put in the `overrides` directory:
|
||||||
|
|
||||||
The directory layout of the theme is as follows:
|
|
||||||
|
|
||||||
``` sh
|
``` sh
|
||||||
.
|
.
|
||||||
@ -123,8 +113,7 @@ The directory layout of the theme is as follows:
|
|||||||
│ ├─ search.html # Search box
|
│ ├─ search.html # Search box
|
||||||
│ ├─ social.html # Social links
|
│ ├─ social.html # Social links
|
||||||
│ ├─ source.html # Repository information
|
│ ├─ source.html # Repository information
|
||||||
│ ├─ source-date.html # Last updated date
|
│ ├─ source-file.html # Source file information
|
||||||
│ ├─ source-link.html # Link to source file
|
|
||||||
│ ├─ tabs.html # Tabs navigation
|
│ ├─ tabs.html # Tabs navigation
|
||||||
│ ├─ tabs-item.html # Tabs navigation item
|
│ ├─ tabs-item.html # Tabs navigation item
|
||||||
│ ├─ toc.html # Table of contents
|
│ ├─ toc.html # Table of contents
|
||||||
@ -134,11 +123,14 @@ The directory layout of the theme is as follows:
|
|||||||
└─ main.html # Default page
|
└─ main.html # Default page
|
||||||
```
|
```
|
||||||
|
|
||||||
|
[custom_dir]: https://www.mkdocs.org/user-guide/configuration/#custom_dir
|
||||||
|
[name]: https://www.mkdocs.org/user-guide/configuration/#name
|
||||||
|
|
||||||
### Overriding partials
|
### Overriding partials
|
||||||
|
|
||||||
In order to override a partial, we can replace it with a file of the same name
|
In order to override a partial, we can replace it with a file of the same name
|
||||||
and location in the `overrides` directory. For example, to replace the original
|
and location in the `overrides` directory. For example, to replace the original
|
||||||
`footer.html`, create a `footer.html` file in the `overrides/partials`
|
`footer.html` partial, create a new `footer.html` partial in the `overrides`
|
||||||
directory:
|
directory:
|
||||||
|
|
||||||
``` sh
|
``` sh
|
||||||
@ -155,9 +147,9 @@ with any file.
|
|||||||
### Overriding blocks <small>recommended</small> { #overriding-blocks data-toc-label="Overriding blocks" }
|
### Overriding blocks <small>recommended</small> { #overriding-blocks data-toc-label="Overriding blocks" }
|
||||||
|
|
||||||
Besides overriding partials, it's also possible to override (and extend)
|
Besides overriding partials, it's also possible to override (and extend)
|
||||||
_template blocks_, which are defined inside the templates and wrap specific
|
template blocks, which are defined inside the templates and wrap specific
|
||||||
features. To override a block, create a `main.html` file inside the `overrides`
|
features. In order to set up block overrides, create a `main.html` file inside
|
||||||
directory:
|
the `overrides` directory:
|
||||||
|
|
||||||
``` sh
|
``` sh
|
||||||
.
|
.
|
||||||
@ -166,7 +158,7 @@ directory:
|
|||||||
└─ mkdocs.yml
|
└─ mkdocs.yml
|
||||||
```
|
```
|
||||||
|
|
||||||
Then, e.g. to override the site title, add the following line to `main.html`:
|
Then, e.g. to override the site title, add the following lines to `main.html`:
|
||||||
|
|
||||||
``` html
|
``` html
|
||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
@ -176,7 +168,7 @@ Then, e.g. to override the site title, add the following line to `main.html`:
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
```
|
```
|
||||||
|
|
||||||
Material for MkDocs provides the following template blocks:
|
The following template blocks are provided by the theme:
|
||||||
|
|
||||||
| Block name | Purpose |
|
| Block name | Purpose |
|
||||||
|:------------------|:------------------------------------------------|
|
|:------------------|:------------------------------------------------|
|
||||||
@ -194,16 +186,11 @@ Material for MkDocs provides the following template blocks:
|
|||||||
| `libs` | Wraps the JavaScript libraries (header) |
|
| `libs` | Wraps the JavaScript libraries (header) |
|
||||||
| `outdated` | Wraps the version warning |
|
| `outdated` | Wraps the version warning |
|
||||||
| `scripts` | Wraps the JavaScript application (footer) |
|
| `scripts` | Wraps the JavaScript application (footer) |
|
||||||
| `source` | Wraps the linked source files |
|
|
||||||
| `site_meta` | Wraps the meta tags in the document head |
|
| `site_meta` | Wraps the meta tags in the document head |
|
||||||
| `site_nav` | Wraps the site navigation and table of contents |
|
| `site_nav` | Wraps the site navigation and table of contents |
|
||||||
| `styles` | Wraps the stylesheets (also extra sources) |
|
| `styles` | Wraps the style sheets (also extra sources) |
|
||||||
| `tabs` | Wraps the tabs navigation (if available) |
|
| `tabs` | Wraps the tabs navigation (if available) |
|
||||||
|
|
||||||
For more on this topic refer to the [MkDocs documentation][5].
|
|
||||||
|
|
||||||
[5]: https://www.mkdocs.org/user-guide/styling-your-docs/#overriding-template-blocks
|
|
||||||
|
|
||||||
#### Additional variables
|
#### Additional variables
|
||||||
|
|
||||||
Besides template blocks, Material for MkDocs provides extra variables for parts
|
Besides template blocks, Material for MkDocs provides extra variables for parts
|
||||||
@ -220,7 +207,7 @@ with Material for MkDocs_ hint in the footer, add the following line to
|
|||||||
{% endset %}
|
{% endset %}
|
||||||
```
|
```
|
||||||
|
|
||||||
Material for MkDocs provides the following additional variables:
|
The following template variables are provided by the theme:
|
||||||
|
|
||||||
| Block name | Purpose |
|
| Block name | Purpose |
|
||||||
|:------------------|:------------------------------------------------|
|
|:------------------|:------------------------------------------------|
|
||||||
@ -228,25 +215,25 @@ Material for MkDocs provides the following additional variables:
|
|||||||
|
|
||||||
## Theme development
|
## Theme development
|
||||||
|
|
||||||
Material for MkDocs is built on top of [TypeScript][6], [RxJS][7] and [SASS][8],
|
Material for MkDocs is built on top of [TypeScript], [RxJS] and [SASS], and
|
||||||
and uses a lean, custom build process to put everything together.[^1] If you
|
uses a lean, custom build process to put everything together.[^1] If you want
|
||||||
want to make more fundamental changes, it may be necessary to make the
|
to make more fundamental changes, it may be necessary to make the adjustments
|
||||||
adjustments directly in the source of the theme and recompile it.
|
directly in the source of the theme and recompile it.
|
||||||
|
|
||||||
[^1]:
|
[^1]:
|
||||||
Prior to version 7.0, the build was based on Webpack. This led to broken
|
Prior to :octicons-tag-24: 7.0.0 the build was based on Webpack, resulting
|
||||||
builds due to frequent incompatibilities with loaders and plugins, so we
|
in occasional broken builds due to incompatibilities with loaders and
|
||||||
decided to swap Webpack for a leaner custom solution which is now based on
|
plugins. Therefore, we decided to swap Webpack for a leaner solution which
|
||||||
[RxJS][7] as the application itself. This enabled us to remove more than
|
is now based on [RxJS] as the application itself. This allowed for the
|
||||||
500 dependencies (~30% less).
|
pruning of more than 500 dependencies (~30% less).
|
||||||
|
|
||||||
[6]: https://www.typescriptlang.org/
|
[TypeScript]: https://www.typescriptlang.org/
|
||||||
[7]: https://github.com/ReactiveX/rxjs
|
[RxJS]: https://github.com/ReactiveX/rxjs
|
||||||
[8]: https://sass-lang.com
|
[SASS]: https://sass-lang.com
|
||||||
|
|
||||||
### Environment setup
|
### Environment setup
|
||||||
|
|
||||||
In order to start development on Material for MkDocs, a [Node.js][9] version of
|
In order to start development on Material for MkDocs, a [Node.js] version of
|
||||||
at least 14 is required. First, clone the repository:
|
at least 14 is required. First, clone the repository:
|
||||||
|
|
||||||
```
|
```
|
||||||
@ -263,7 +250,7 @@ pip install mkdocs-redirects
|
|||||||
npm install
|
npm install
|
||||||
```
|
```
|
||||||
|
|
||||||
[9]: https://nodejs.org
|
[Node.js]: https://nodejs.org
|
||||||
|
|
||||||
### Development mode
|
### Development mode
|
||||||
|
|
||||||
@ -273,14 +260,14 @@ Start the watcher with:
|
|||||||
npm start
|
npm start
|
||||||
```
|
```
|
||||||
|
|
||||||
Then, in a second session, start the MkDocs live preview server with:
|
Then, in a second terminal window, start the MkDocs live preview server with:
|
||||||
|
|
||||||
```
|
```
|
||||||
mkdocs serve
|
mkdocs serve
|
||||||
```
|
```
|
||||||
|
|
||||||
Point your browser to [localhost:8000][10] and you should see this documentation
|
Point your browser to [localhost:8000][live preview] and you should see this
|
||||||
in front of you.
|
very documentation in front of you.
|
||||||
|
|
||||||
!!! warning "Automatically generated files"
|
!!! warning "Automatically generated files"
|
||||||
|
|
||||||
@ -288,7 +275,7 @@ in front of you.
|
|||||||
directory are automatically generated from the `src` directory and will be
|
directory are automatically generated from the `src` directory and will be
|
||||||
overwritten when the theme is built.
|
overwritten when the theme is built.
|
||||||
|
|
||||||
[10]: http://localhost:8000
|
[live preview]: http://localhost:8000
|
||||||
|
|
||||||
### Building the theme
|
### Building the theme
|
||||||
|
|
||||||
@ -298,10 +285,7 @@ When you're finished making your changes, you can build the theme by invoking:
|
|||||||
npm run build
|
npm run build
|
||||||
```
|
```
|
||||||
|
|
||||||
This triggers the production-level compilation and minification of all
|
This triggers the production-level compilation and minification of all style
|
||||||
stylesheets and JavaScript sources. When the command exits, the final files are
|
sheets and JavaScript files. After the command exits, the compiled files are
|
||||||
located in the `material` directory. Add the `theme_dir` variable pointing to
|
located in the `material` directory. When running `mkdocs build`, you should
|
||||||
the aforementioned directory in the original `mkdocs.yml`.
|
now see your changes to the original theme.
|
||||||
|
|
||||||
Now you can run `mkdocs build` and you should see your documentation with your
|
|
||||||
changes to the original theme.
|
|
||||||
|
@ -1,31 +0,0 @@
|
|||||||
---
|
|
||||||
template: overrides/main.html
|
|
||||||
---
|
|
||||||
|
|
||||||
# Data privacy
|
|
||||||
|
|
||||||
In itself, Material for MkDocs does not perform any tracking and adheres to the
|
|
||||||
[General Data Protection Regulation][1] (GDPR), but it integrates with some
|
|
||||||
third-party services that may not.
|
|
||||||
|
|
||||||
[1]: https://en.wikipedia.org/wiki/General_Data_Protection_Regulation
|
|
||||||
|
|
||||||
## Third-party services
|
|
||||||
|
|
||||||
### Google Fonts
|
|
||||||
|
|
||||||
Material for MkDocs makes fonts [configurable][2] by relying on Google Fonts
|
|
||||||
CDN, which may be in breach with GDPR. The usage of Google's CDN can be [easily
|
|
||||||
disabled][3] via `mkdocs.yml`.
|
|
||||||
|
|
||||||
[2]: setup/changing-the-fonts.md
|
|
||||||
[3]: setup/changing-the-fonts.md#autoloading
|
|
||||||
|
|
||||||
### Google Analytics and Disqus
|
|
||||||
|
|
||||||
Material for MkDocs comes with optional [Google Analytics][4] and [Disqus][5]
|
|
||||||
integrations, both of which must be enabled explicitly, so there's no immediate
|
|
||||||
action if you don't use those.
|
|
||||||
|
|
||||||
[4]: setup/setting-up-site-analytics.md#google-analytics
|
|
||||||
[5]: setup/adding-a-comment-system.md#disqus
|
|
@ -5,17 +5,14 @@ title: Getting started
|
|||||||
|
|
||||||
# Getting started
|
# Getting started
|
||||||
|
|
||||||
Material for MkDocs is a theme for [MkDocs][1], a static site generator geared
|
Material for MkDocs is a theme for [MkDocs], a static site generator geared
|
||||||
towards (technical) project documentation. If you're familiar with Python, you
|
towards (technical) project documentation. If you're familiar with Python, you
|
||||||
can install Material for MkDocs with [`pip`][2], the Python package manager.
|
can install Material for MkDocs with [`pip`][pip], the Python package manager.
|
||||||
If not, we recommended using [`docker`][3].
|
If not, we recommended using [`docker`][docker].
|
||||||
|
|
||||||
In case you're running into problems, consult the [troubleshooting][4] section.
|
[MkDocs]: https://www.mkdocs.org
|
||||||
|
[pip]: #with-pip
|
||||||
[1]: https://www.mkdocs.org
|
[docker]: #with-docker
|
||||||
[2]: #with-pip-recommended
|
|
||||||
[3]: #with-docker
|
|
||||||
[4]: troubleshooting.md
|
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
@ -28,17 +25,17 @@ pip install mkdocs-material
|
|||||||
```
|
```
|
||||||
|
|
||||||
This will automatically install compatible versions of all dependencies:
|
This will automatically install compatible versions of all dependencies:
|
||||||
[MkDocs][1], [Markdown][5], [Pygments][6] and [Python Markdown Extensions][7].
|
[MkDocs], [Markdown], [Pygments] and [Python Markdown Extensions]. Material for
|
||||||
Material for MkDocs always strives to support the latest versions, so there's
|
MkDocs always strives to support the latest versions, so there's no need to
|
||||||
no need to install those packages separately.
|
install those packages separately.
|
||||||
|
|
||||||
[5]: https://python-markdown.github.io/
|
[Markdown]: https://python-markdown.github.io/
|
||||||
[6]: https://pygments.org/
|
[Pygments]: https://pygments.org/
|
||||||
[7]: https://facelessuser.github.io/pymdown-extensions/
|
[Python Markdown Extensions]: https://facelessuser.github.io/pymdown-extensions/
|
||||||
|
|
||||||
### with docker
|
### with docker
|
||||||
|
|
||||||
The official [Docker image][8] is a great way to get up and running in a few
|
The official [Docker image] is a great way to get up and running in a few
|
||||||
minutes, as it comes with all dependencies pre-installed. Pull the image for the
|
minutes, as it comes with all dependencies pre-installed. Pull the image for the
|
||||||
`latest` version with:
|
`latest` version with:
|
||||||
|
|
||||||
@ -52,12 +49,12 @@ covered in the following sections.
|
|||||||
|
|
||||||
The following plugins are bundled with the Docker image:
|
The following plugins are bundled with the Docker image:
|
||||||
|
|
||||||
- [mkdocs-minify-plugin][9]
|
- [mkdocs-minify-plugin]
|
||||||
- [mkdocs-redirects][10]
|
- [mkdocs-redirects]
|
||||||
|
|
||||||
[8]: https://hub.docker.com/r/squidfunk/mkdocs-material/
|
[Docker image]: https://hub.docker.com/r/squidfunk/mkdocs-material/
|
||||||
[9]: https://github.com/byrnereese/mkdocs-minify-plugin
|
[mkdocs-minify-plugin]: https://github.com/byrnereese/mkdocs-minify-plugin
|
||||||
[10]: https://github.com/datarobot/mkdocs-redirects
|
[mkdocs-redirects]: https://github.com/datarobot/mkdocs-redirects
|
||||||
|
|
||||||
??? question "How to add plugins to the Docker image?"
|
??? question "How to add plugins to the Docker image?"
|
||||||
|
|
||||||
@ -82,19 +79,19 @@ The following plugins are bundled with the Docker image:
|
|||||||
!!! info ":material-apple: Apple Silicon (M1) and :fontawesome-brands-raspberry-pi: Raspberry Pi"
|
!!! info ":material-apple: Apple Silicon (M1) and :fontawesome-brands-raspberry-pi: Raspberry Pi"
|
||||||
|
|
||||||
The official Docker image is only available for `linux/amd64`. We recommend
|
The official Docker image is only available for `linux/amd64`. We recommend
|
||||||
the [third-party image][11] by @afritzler if you want to run Material for
|
the [third-party image] by @afritzler if you want to run Material for MkDocs
|
||||||
MkDocs via Docker on `arm64` or `armv7`, as it is automatically built on
|
via Docker on `arm64` or `armv7`, as it is automatically built on every
|
||||||
every release:
|
release:
|
||||||
|
|
||||||
```
|
```
|
||||||
docker pull ghcr.io/afritzler/mkdocs-material
|
docker pull ghcr.io/afritzler/mkdocs-material
|
||||||
```
|
```
|
||||||
|
|
||||||
[11]: https://github.com/afritzler/mkdocs-material
|
[third-party image]: https://github.com/afritzler/mkdocs-material
|
||||||
|
|
||||||
### with git
|
### with git
|
||||||
|
|
||||||
Material for MkDocs can be directly used from [GitHub][12] by cloning the
|
Material for MkDocs can be directly used from [GitHub] by cloning the
|
||||||
repository into a subfolder of your project root which might be useful if you
|
repository into a subfolder of your project root which might be useful if you
|
||||||
want to use the very latest version:
|
want to use the very latest version:
|
||||||
|
|
||||||
@ -106,7 +103,7 @@ The theme will reside in the folder `mkdocs-material/material`. When cloning
|
|||||||
from `git`, you must install all required dependencies yourself:
|
from `git`, you must install all required dependencies yourself:
|
||||||
|
|
||||||
```
|
```
|
||||||
pip install -r mkdocs-material/requirements.txt
|
pip install -e mkdocs-material
|
||||||
```
|
```
|
||||||
|
|
||||||
[12]: https://github.com/squidfunk/mkdocs-material
|
[GitHub]: https://github.com/squidfunk/mkdocs-material
|
||||||
|
@ -7,13 +7,13 @@ title: Switching to Insiders
|
|||||||
|
|
||||||
Material for MkDocs Insiders is a fully compatible drop-in replacement for
|
Material for MkDocs Insiders is a fully compatible drop-in replacement for
|
||||||
Material for MkDocs, and can be installed similar to the public version using
|
Material for MkDocs, and can be installed similar to the public version using
|
||||||
[`pip`][1], [`docker`][2] or [`git`][3]. When you sponsor @squidfunk, your
|
[`pip`][pip], [`docker`][docker] or [`git`][git]. When you sponsor @squidfunk,
|
||||||
account is added to the list of collaborators of the private Insiders
|
your account is added to the list of collaborators of the private Insiders
|
||||||
repository.
|
repository.
|
||||||
|
|
||||||
[1]: #with-pip-recommended
|
[pip]: #with-pip
|
||||||
[2]: #with-docker
|
[docker]: #with-docker
|
||||||
[3]: #with-git
|
[git]: #with-git
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
|
@ -10,15 +10,15 @@ makes this ridiculously simple.
|
|||||||
|
|
||||||
## GitHub Pages
|
## GitHub Pages
|
||||||
|
|
||||||
If you're already hosting your code on GitHub, [GitHub Pages][1] is certainly
|
If you're already hosting your code on GitHub, [GitHub Pages] is certainly
|
||||||
the most convenient way to publish your project documentation. It's free of
|
the most convenient way to publish your project documentation. It's free of
|
||||||
charge and pretty easy to set up.
|
charge and pretty easy to set up.
|
||||||
|
|
||||||
[1]: https://pages.github.com/
|
[GitHub Pages]: https://pages.github.com/
|
||||||
|
|
||||||
### with GitHub Actions
|
### with GitHub Actions
|
||||||
|
|
||||||
Using [GitHub Actions][2] you can automate the deployment of your project
|
Using [GitHub Actions] you can automate the deployment of your project
|
||||||
documentation. At the root of your repository, create a new GitHub Actions
|
documentation. At the root of your repository, create a new GitHub Actions
|
||||||
workflow, e.g. `.github/workflows/ci.yml`, and copy and paste the following
|
workflow, e.g. `.github/workflows/ci.yml`, and copy and paste the following
|
||||||
contents:
|
contents:
|
||||||
@ -49,7 +49,7 @@ contents:
|
|||||||
2. At some point, GitHub renamed `master` to `main`. If your default branch
|
2. At some point, GitHub renamed `master` to `main`. If your default branch
|
||||||
is named `master`, you can safely remove `main`, vice versa.
|
is named `master`, you can safely remove `main`, vice versa.
|
||||||
|
|
||||||
3. This is the place to install further [MkDocs plugins][3] or Markdown
|
3. This is the place to install further [MkDocs plugins] or Markdown
|
||||||
extensions with `pip` to be used during the build:
|
extensions with `pip` to be used during the build:
|
||||||
|
|
||||||
``` sh
|
``` sh
|
||||||
@ -80,24 +80,24 @@ contents:
|
|||||||
- run: pip install git+https://${GH_TOKEN}@github.com/squidfunk/mkdocs-material-insiders.git
|
- run: pip install git+https://${GH_TOKEN}@github.com/squidfunk/mkdocs-material-insiders.git
|
||||||
- run: mkdocs gh-deploy --force
|
- run: mkdocs gh-deploy --force
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
GH_TOKEN: ${{ secrets.GH_TOKEN }} # (1)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
1. Remember to set the `GH_TOKEN` environment variable to the value of your
|
||||||
|
[personal access token] when deploying [Insiders], which can be done
|
||||||
|
using [GitHub secrets].
|
||||||
|
|
||||||
Now, when a new commit is pushed to either the `master` or `main` branches,
|
Now, when a new commit is pushed to either the `master` or `main` branches,
|
||||||
the static site is automatically built and deployed. Push your changes to see
|
the static site is automatically built and deployed. Push your changes to see
|
||||||
the workflow in action.
|
the workflow in action.
|
||||||
|
|
||||||
Your documentation should shortly appear at `<username>.github.io/<repository>`.
|
Your documentation should shortly appear at `<username>.github.io/<repository>`.
|
||||||
|
|
||||||
_Remember to set the_ `GH_TOKEN` _environment variable to the value of your
|
[GitHub Actions]: https://github.com/features/actions
|
||||||
[personal access token][4] when deploying [Insiders][5], which can be done
|
[MkDocs plugins]: https://github.com/mkdocs/mkdocs/wiki/MkDocs-Plugins
|
||||||
using [secrets][6]._
|
[personal access token]: https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token
|
||||||
|
[Insiders]: insiders/index.md
|
||||||
[2]: https://github.com/features/actions
|
[GitHub secrets]: https://docs.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets
|
||||||
[3]: https://github.com/mkdocs/mkdocs/wiki/MkDocs-Plugins
|
|
||||||
[4]: https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token
|
|
||||||
[5]: insiders/index.md
|
|
||||||
[6]: https://docs.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets
|
|
||||||
|
|
||||||
### with MkDocs
|
### with MkDocs
|
||||||
|
|
||||||
@ -110,10 +110,10 @@ mkdocs gh-deploy --force
|
|||||||
|
|
||||||
## GitLab Pages
|
## GitLab Pages
|
||||||
|
|
||||||
If you're hosting your code on GitLab, deploying to [GitLab Pages][7] can be
|
If you're hosting your code on GitLab, deploying to [GitLab Pages] can be done
|
||||||
done by using the [GitLab CI][8] task runner. At the root of your repository,
|
by using the [GitLab CI] task runner. At the root of your repository, create a
|
||||||
create a task definition named `.gitlab-ci.yml` and copy and paste the
|
task definition named `.gitlab-ci.yml` and copy and paste the following
|
||||||
following contents:
|
contents:
|
||||||
|
|
||||||
=== "Material for MkDocs"
|
=== "Material for MkDocs"
|
||||||
|
|
||||||
@ -139,7 +139,7 @@ following contents:
|
|||||||
stage: deploy
|
stage: deploy
|
||||||
only:
|
only:
|
||||||
- master
|
- master
|
||||||
script:
|
script: # (1)
|
||||||
- pip install git+https://${GH_TOKEN}@github.com/squidfunk/mkdocs-material-insiders.git
|
- pip install git+https://${GH_TOKEN}@github.com/squidfunk/mkdocs-material-insiders.git
|
||||||
- mkdocs build --site-dir public
|
- mkdocs build --site-dir public
|
||||||
artifacts:
|
artifacts:
|
||||||
@ -147,16 +147,16 @@ following contents:
|
|||||||
- public
|
- public
|
||||||
```
|
```
|
||||||
|
|
||||||
|
1. Remember to set the `GH_TOKEN` environment variable to the value of your
|
||||||
|
[personal access token] when deploying [Insiders], which can be done
|
||||||
|
using [masked custom variables].
|
||||||
|
|
||||||
Now, when a new commit is pushed to `master`, the static site is automatically
|
Now, when a new commit is pushed to `master`, the static site is automatically
|
||||||
built and deployed. Commit and push the file to your repository to see the
|
built and deployed. Commit and push the file to your repository to see the
|
||||||
workflow in action.
|
workflow in action.
|
||||||
|
|
||||||
Your documentation should shortly appear at `<username>.gitlab.io/<repository>`.
|
Your documentation should shortly appear at `<username>.gitlab.io/<repository>`.
|
||||||
|
|
||||||
_Remember to set the_ `GH_TOKEN` _environment variable to the value of your
|
[GitLab Pages]: https://gitlab.com/pages
|
||||||
[personal access token][4] when deploying [Insiders][5], which can be done
|
[GitLab CI]: https://docs.gitlab.com/ee/ci/
|
||||||
using [masked custom variables][9]._
|
[masked custom variables]: https://docs.gitlab.com/ee/ci/variables/#create-a-custom-variable-in-the-ui
|
||||||
|
|
||||||
[7]: https://gitlab.com/pages
|
|
||||||
[8]: https://docs.gitlab.com/ee/ci/
|
|
||||||
[9]: https://docs.gitlab.com/ee/ci/variables/#create-a-custom-variable-in-the-ui
|
|
||||||
|
@ -11,9 +11,14 @@ documents can be linked to specific source files.
|
|||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
|
### Repository
|
||||||
|
|
||||||
|
[:octicons-tag-24: 0.1.0][repo_url support] ·
|
||||||
|
:octicons-milestone-24: Default: _none_
|
||||||
|
|
||||||
In order to display a link to the repository of your project as part of your
|
In order to display a link to the repository of your project as part of your
|
||||||
documentation, set [`repo_url`][1] in `mkdocs.yml` to the public URL of your
|
documentation, set [`repo_url`][repo_url] in `mkdocs.yml` to the public URL of
|
||||||
repository, e.g.:
|
your repository, e.g.:
|
||||||
|
|
||||||
``` yaml
|
``` yaml
|
||||||
repo_url: https://github.com/squidfunk/mkdocs-material
|
repo_url: https://github.com/squidfunk/mkdocs-material
|
||||||
@ -21,35 +26,38 @@ repo_url: https://github.com/squidfunk/mkdocs-material
|
|||||||
|
|
||||||
The link to the repository will be rendered next to the search bar on big
|
The link to the repository will be rendered next to the search bar on big
|
||||||
screens and as part of the main navigation drawer on smaller screen sizes.
|
screens and as part of the main navigation drawer on smaller screen sizes.
|
||||||
Additionally, for GitHub and GitLab, the number of stars and forks is
|
Additionally, for public repositories hosted on [GitHub] or [GitLab], the
|
||||||
automatically requested and rendered for _public repositories_.
|
number of stars and forks is automatically requested and rendered.
|
||||||
|
|
||||||
[1]: https://www.mkdocs.org/user-guide/configuration/#repo_url
|
[repo_url support]: https://github.com/squidfunk/mkdocs-material/releases/tag/0.1.0
|
||||||
|
[repo_url]: https://www.mkdocs.org/user-guide/configuration/#repo_url
|
||||||
|
|
||||||
### Repository name
|
### Repository name
|
||||||
|
|
||||||
[:octicons-file-code-24: Source][2] · :octicons-milestone-24: Default:
|
[:octicons-tag-24: 0.1.0][repo_name support] ·
|
||||||
_automatically set to_ `GitHub`, `GitLab` _or_ `Bitbucket`
|
:octicons-milestone-24: Default: _automatically set to_ `GitHub`, `GitLab` _or_
|
||||||
|
`Bitbucket`
|
||||||
|
|
||||||
MkDocs will infer the source provider by examining the URL and try to set the
|
MkDocs will infer the source provider by examining the URL and try to set the
|
||||||
_repository name_ automatically. If you wish to customize the name, set
|
_repository name_ automatically. If you wish to customize the name, set
|
||||||
[`repo_name`][3] in `mkdocs.yml`:
|
[`repo_name`][repo_name] in `mkdocs.yml`:
|
||||||
|
|
||||||
``` yaml
|
``` yaml
|
||||||
repo_name: squidfunk/mkdocs-material
|
repo_name: squidfunk/mkdocs-material
|
||||||
```
|
```
|
||||||
|
|
||||||
[2]: https://github.com/squidfunk/mkdocs-material/blob/master/src/partials/source.html
|
[repo_name support]: https://github.com/squidfunk/mkdocs-material/releases/tag/0.1.0
|
||||||
[3]: https://www.mkdocs.org/user-guide/configuration/#repo_name
|
[repo_name]: https://www.mkdocs.org/user-guide/configuration/#repo_name
|
||||||
|
|
||||||
### Repository icon
|
### Repository icon
|
||||||
|
|
||||||
[:octicons-file-code-24: Source][2] · :octicons-milestone-24: Default:
|
[:octicons-tag-24: 5.0.0][icon.repo support] ·
|
||||||
`fontawesome/brands/git-alt`
|
:octicons-milestone-24: Default:
|
||||||
|
[`fontawesome/brands/git-alt`][icon.repo default]
|
||||||
|
|
||||||
While the default _repository icon_ is a generic git icon, it can be set to
|
While the default repository icon is a generic git icon, it can be set to
|
||||||
[any icon bundled with the theme][4] by referencing a valid icon path in
|
[any icon bundled with the theme][custom icons] by referencing a valid icon
|
||||||
`mkdocs.yml`:
|
path in `mkdocs.yml`:
|
||||||
|
|
||||||
``` yaml
|
``` yaml
|
||||||
theme:
|
theme:
|
||||||
@ -70,16 +78,18 @@ Some popular choices:
|
|||||||
- :fontawesome-brands-bitbucket: – `fontawesome/brands/bitbucket`
|
- :fontawesome-brands-bitbucket: – `fontawesome/brands/bitbucket`
|
||||||
- :fontawesome-solid-trash: – `fontawesome/solid/trash`
|
- :fontawesome-solid-trash: – `fontawesome/solid/trash`
|
||||||
|
|
||||||
[4]: https://github.com/squidfunk/mkdocs-material/tree/master/material/.icons
|
[icon.repo support]: https://github.com/squidfunk/mkdocs-material/releases/tag/5.0.0
|
||||||
|
[icon.repo default]: https://github.com/squidfunk/mkdocs-material/blob/master/material/.icons/fontawesome/brands/git-alt.svg
|
||||||
|
[custom icons]: https://github.com/squidfunk/mkdocs-material/tree/master/material/.icons
|
||||||
|
|
||||||
### Edit button
|
### Edit button
|
||||||
|
|
||||||
[:octicons-file-code-24: Source][5] · :octicons-milestone-24: Default:
|
[:octicons-tag-24: 0.1.0][edit_uri support] ·
|
||||||
_automatically set_
|
:octicons-milestone-24: Default: _automatically set_
|
||||||
|
|
||||||
If the repository URL points to a [GitHub][6], [GitLab][7] or [Bitbucket][8]
|
If the repository URL points to a [GitHub], [GitLab] or [Bitbucket] repository,
|
||||||
repository, an _edit button_ is displayed at the top of each document. This
|
an edit button is displayed at the top of each document. This behavior can be
|
||||||
behavior can be changed by setting [`edit_uri`][9] in `mkdocs.yml`:
|
changed by setting [`edit_uri`][edit_uri] in `mkdocs.yml`:
|
||||||
|
|
||||||
=== "Customize edit path"
|
=== "Customize edit path"
|
||||||
|
|
||||||
@ -93,39 +103,39 @@ behavior can be changed by setting [`edit_uri`][9] in `mkdocs.yml`:
|
|||||||
edit_uri: ""
|
edit_uri: ""
|
||||||
```
|
```
|
||||||
|
|
||||||
[5]: https://github.com/squidfunk/mkdocs-material/blob/master/src/base.html
|
[edit_uri support]: https://github.com/squidfunk/mkdocs-material/releases/tag/0.1.0
|
||||||
[6]: https://github.com/
|
[edit_uri]: https://www.mkdocs.org/user-guide/configuration/#edit_uri
|
||||||
[7]: https://about.gitlab.com/
|
[GitHub]: https://github.com/
|
||||||
[8]: https://bitbucket.org/
|
[GitLab]: https://about.gitlab.com/
|
||||||
[9]: https://www.mkdocs.org/user-guide/configuration/#edit_uri
|
[Bitbucket]: https://bitbucket.org/
|
||||||
|
|
||||||
### Revision date
|
### Revision date
|
||||||
|
|
||||||
[:octicons-file-code-24: Source][10] ·
|
[:octicons-tag-24: 4.6.0][git-revision-date support] ·
|
||||||
[:octicons-cpu-24: Plugin][11]
|
[:octicons-cpu-24: Plugin][git-revision-date]
|
||||||
|
|
||||||
The [git-revision-date][10] plugin adds support for displaying the date a
|
The [git-revision-date] plugin adds support for displaying the date a
|
||||||
document was _last updated_ at the bottom of each page. It can be installed
|
document was last updated at the bottom of each page. It can be installed
|
||||||
with `pip`:
|
with `pip`:
|
||||||
|
|
||||||
```
|
```
|
||||||
pip install mkdocs-git-revision-date-plugin
|
pip install mkdocs-git-revision-date-plugin
|
||||||
```
|
```
|
||||||
|
|
||||||
Then, add the following to `mkdocs.yml`:
|
Then, add the following lines to `mkdocs.yml`:
|
||||||
|
|
||||||
``` yaml
|
``` yaml
|
||||||
plugins:
|
plugins:
|
||||||
- git-revision-date
|
- git-revision-date
|
||||||
```
|
```
|
||||||
|
|
||||||
The following options are supported:
|
The following configuration options are supported:
|
||||||
|
|
||||||
`enabled_if_env`{ #enabled-if-env }
|
`enabled_if_env`{ #enabled-if-env }
|
||||||
|
|
||||||
: :octicons-milestone-24: Default: _none_ – When specified the data will only be extracted from git
|
: :octicons-milestone-24: Default: _none_ – When specified, the plugin will
|
||||||
if the environment variable exists. This makes it possible to disable
|
only be invoked if the environment variable exists. This makes it easy to
|
||||||
extraction for cases when the repository is not available:
|
disable extraction for cases when the repository is not available:
|
||||||
|
|
||||||
``` yaml
|
``` yaml
|
||||||
plugins:
|
plugins:
|
||||||
@ -133,21 +143,21 @@ The following options are supported:
|
|||||||
enabled_if_env: CI
|
enabled_if_env: CI
|
||||||
```
|
```
|
||||||
|
|
||||||
_Material for MkDocs doesn't provide official support for the other options of
|
The other configuration options of this extension are not officially supported
|
||||||
this plugin, so they may be supported but might yield unexpected results.
|
by Material for MkDocs, which is why they may yield unexpected results. Use
|
||||||
Use them at your own risk._
|
them at your own risk.
|
||||||
|
|
||||||
[10]: https://github.com/squidfunk/mkdocs-material/blob/master/src/partials/source-date.html
|
[git-revision-date support]: https://github.com/squidfunk/mkdocs-material/releases/tag/4.6.0
|
||||||
[11]: https://github.com/zhaoterryy/mkdocs-git-revision-date-plugin
|
[git-revision-date]: https://github.com/zhaoterryy/mkdocs-git-revision-date-plugin
|
||||||
|
|
||||||
### Revision date, localized
|
### Revision date, localized
|
||||||
|
|
||||||
[:octicons-file-code-24: Source][10] ·
|
[:octicons-tag-24: 4.6.0][git-revision-date-localized support] ·
|
||||||
[:octicons-cpu-24: Plugin][12]
|
[:octicons-cpu-24: Plugin][git-revision-date-localized]
|
||||||
|
|
||||||
Similarly, the [git-revision-date-localized][12] plugin adds support for adding
|
Similarly, the [git-revision-date-localized] plugin adds support for adding
|
||||||
a localized _updated at_ and _created at_ date at the bottom of each page. It
|
a localized update and creation date at the bottom of each page. It can be
|
||||||
can be installed with `pip`:
|
installed with `pip`:
|
||||||
|
|
||||||
```
|
```
|
||||||
pip install mkdocs-git-revision-date-localized-plugin
|
pip install mkdocs-git-revision-date-localized-plugin
|
||||||
@ -160,7 +170,7 @@ plugins:
|
|||||||
- git-revision-date-localized
|
- git-revision-date-localized
|
||||||
```
|
```
|
||||||
|
|
||||||
The following options are supported:
|
The following configuration options are supported:
|
||||||
|
|
||||||
`type`{ #type }
|
`type`{ #type }
|
||||||
|
|
||||||
@ -178,7 +188,7 @@ The following options are supported:
|
|||||||
|
|
||||||
: :octicons-milestone-24: Default: `false` – Enables falling back to
|
: :octicons-milestone-24: Default: `false` – Enables falling back to
|
||||||
the time when `mkdocs build` was executed. Can be used as a fallback when
|
the time when `mkdocs build` was executed. Can be used as a fallback when
|
||||||
the build is performed outside of the git repository:
|
the build is performed outside of a git repository:
|
||||||
|
|
||||||
``` yaml
|
``` yaml
|
||||||
plugins:
|
plugins:
|
||||||
@ -189,8 +199,8 @@ The following options are supported:
|
|||||||
`enable_creation_date`{ #enable-creation-date }
|
`enable_creation_date`{ #enable-creation-date }
|
||||||
|
|
||||||
: :octicons-milestone-24: Default: `false` – Enables the display of the
|
: :octicons-milestone-24: Default: `false` – Enables the display of the
|
||||||
_created at_ date of the file associated with the page next to the
|
creation date of the file associated with the page next to the last updated
|
||||||
_updated at_ date at the bottom of the page:
|
date at the bottom of the page:
|
||||||
|
|
||||||
``` yaml
|
``` yaml
|
||||||
plugins:
|
plugins:
|
||||||
@ -199,8 +209,9 @@ The following options are supported:
|
|||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
_Material for MkDocs doesn't provide official support for the other options of
|
The other configuration options of this extension are not officially supported
|
||||||
this plugin, so they may be supported but might yield unexpected results.
|
by Material for MkDocs, which is why they may yield unexpected results. Use
|
||||||
Use them at your own risk._
|
them at your own risk.
|
||||||
|
|
||||||
[12]: https://github.com/timvink/mkdocs-git-revision-date-localized-plugin
|
[git-revision-date-localized support]: https://github.com/squidfunk/mkdocs-material/releases/tag/4.6.0
|
||||||
|
[git-revision-date-localized]: https://github.com/timvink/mkdocs-git-revision-date-localized-plugin
|
||||||
|
@ -66,7 +66,7 @@ theme:
|
|||||||
font: false
|
font: false
|
||||||
```
|
```
|
||||||
|
|
||||||
[data privacy]: ../data-privacy.md
|
[data privacy]: https://developers.google.com/fonts/faq#what_does_using_the_google_fonts_api_mean_for_the_privacy_of_my_users
|
||||||
[font=false support]: https://github.com/squidfunk/mkdocs-material/releases/tag/1.0.0
|
[font=false support]: https://github.com/squidfunk/mkdocs-material/releases/tag/1.0.0
|
||||||
|
|
||||||
## Customization
|
## Customization
|
||||||
|
@ -97,7 +97,7 @@ The following configuration options are available:
|
|||||||
|
|
||||||
#### Caching <small>recommended</small> { #caching data-toc-label="Caching" }
|
#### Caching <small>recommended</small> { #caching data-toc-label="Caching" }
|
||||||
|
|
||||||
The [built-in social cards plugin] automatically fetches the fonts you define
|
The [built-in social cards] plugin automatically fetches the fonts you define
|
||||||
in `mkdocs.yml` from Google Fonts, and uses them to render the text that is
|
in `mkdocs.yml` from Google Fonts, and uses them to render the text that is
|
||||||
displayed on the social card. The font files and generated cards are both
|
displayed on the social card. The font files and generated cards are both
|
||||||
written to the `.cache` directory, which is used in subsequent builds to detect
|
written to the `.cache` directory, which is used in subsequent builds to detect
|
||||||
@ -131,12 +131,12 @@ whether the social cards need to be regenerated. You might want to:
|
|||||||
- run: mkdocs gh-deploy --force
|
- run: mkdocs gh-deploy --force
|
||||||
```
|
```
|
||||||
|
|
||||||
[built-in social cards plugin]: #built-in-social-cards
|
[built-in social cards]: #built-in-social-cards
|
||||||
[publishing guide]: ../publishing-your-site.md#with-github-actions
|
[publishing guide]: ../publishing-your-site.md#with-github-actions
|
||||||
|
|
||||||
#### Meta tags
|
#### Meta tags
|
||||||
|
|
||||||
The [built-in social cards plugin] automatically sets all necessary `meta` tags,
|
The [built-in social cards] plugin automatically sets all necessary `meta` tags,
|
||||||
equivalent to the following two customizations, which you can set manually when
|
equivalent to the following two customizations, which you can set manually when
|
||||||
you don't want to use it:
|
you don't want to use it:
|
||||||
|
|
||||||
@ -179,8 +179,6 @@ you don't want to use it:
|
|||||||
```
|
```
|
||||||
|
|
||||||
[Twitter Cards]: https://developer.twitter.com/en/docs/tweets/optimize-with-cards/overview/abouts-cards
|
[Twitter Cards]: https://developer.twitter.com/en/docs/tweets/optimize-with-cards/overview/abouts-cards
|
||||||
[built-in social cards plugin]: ../setup/setting-up-social-cards.md#built-in-social-cards
|
|
||||||
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ The following configuration options are available:
|
|||||||
|
|
||||||
### Adding tags
|
### Adding tags
|
||||||
|
|
||||||
When both, the [built-in tags plugin] and [Metadata] extension are enabled,
|
When both, the [built-in tags] plugin and [Metadata] extension are enabled,
|
||||||
tags can be added for a document with custom front matter. Add the following
|
tags can be added for a document with custom front matter. Add the following
|
||||||
lines at the top of a Markdown file:
|
lines at the top of a Markdown file:
|
||||||
|
|
||||||
@ -80,14 +80,14 @@ following screenshots:
|
|||||||
|
|
||||||
[![Tag search preview]][Tag search preview]
|
[![Tag search preview]][Tag search preview]
|
||||||
|
|
||||||
[built-in tags plugin]: #built-in-tags
|
[built-in tags]: #built-in-tags
|
||||||
[Metadata]: extensions/python-markdown.md#metadata
|
[Metadata]: extensions/python-markdown.md#metadata
|
||||||
[Tags preview]: ../assets/screenshots/tags.png
|
[Tags preview]: ../assets/screenshots/tags.png
|
||||||
[Tag search preview]: ../assets/screenshots/tags-search.png
|
[Tag search preview]: ../assets/screenshots/tags-search.png
|
||||||
|
|
||||||
### Adding a tags index
|
### Adding a tags index
|
||||||
|
|
||||||
The [built-in tags plugin] allows to define a file to render a [tags index]
|
The [built-in tags] plugin allows to define a file to render a [tags index]
|
||||||
[tags.tags_file], which can be any page that is part of the `nav` section. To
|
[tags.tags_file], which can be any page that is part of the `nav` section. To
|
||||||
add a tags index, create a page, e.g. `tags.md`:
|
add a tags index, create a page, e.g. `tags.md`:
|
||||||
|
|
||||||
|
@ -1,117 +0,0 @@
|
|||||||
---
|
|
||||||
template: overrides/main.html
|
|
||||||
---
|
|
||||||
|
|
||||||
# Troubleshooting
|
|
||||||
|
|
||||||
## Theme not recognized
|
|
||||||
|
|
||||||
Operating systems:
|
|
||||||
:fontawesome-brands-apple:
|
|
||||||
:fontawesome-brands-windows:
|
|
||||||
:fontawesome-brands-linux:
|
|
||||||
|
|
||||||
!!! error "Error: Unrecognized theme"
|
|
||||||
|
|
||||||
``` sh
|
|
||||||
mkdocs serve
|
|
||||||
# => INFO - Building documentation...
|
|
||||||
# => ERROR - Config value: 'theme'. Error: Unrecognised theme 'material'.
|
|
||||||
# => ...
|
|
||||||
# => ConfigurationError: Aborted with 1 Configuration Errors!
|
|
||||||
```
|
|
||||||
|
|
||||||
If you run into this error, the most common reason is that you installed MkDocs
|
|
||||||
through some package manager (e.g. `brew` or `apt-get`) and Material for MkDocs
|
|
||||||
through `pip`, so both packages end up in different locations. MkDocs only
|
|
||||||
checks its install location for themes.
|
|
||||||
|
|
||||||
## Inadequate permissions
|
|
||||||
|
|
||||||
Operating systems: :fontawesome-brands-apple:
|
|
||||||
|
|
||||||
!!! error "Error: Permission denied"
|
|
||||||
|
|
||||||
``` sh
|
|
||||||
pip install mkdocs-material
|
|
||||||
# => Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '...'
|
|
||||||
# => Consider using the --user option or check the permissions.
|
|
||||||
```
|
|
||||||
|
|
||||||
When you're running the pre-installed version of Python on macOS, `pip` tries
|
|
||||||
to install packages in a folder for which your user might not have the adequate
|
|
||||||
permissions. There are three possible solutions for this, the recommended one
|
|
||||||
of which is to use virtual environments:
|
|
||||||
|
|
||||||
=== "Virtual environments"
|
|
||||||
|
|
||||||
If you're installing Material for MkDocs with `pip`, the easiest way to make
|
|
||||||
sure that you end up with the correct versions and without any
|
|
||||||
incompatibility problems between packages it to use a [virtual
|
|
||||||
environment][1]. First, ensure that you have a Python version of 3 or
|
|
||||||
higher installed:
|
|
||||||
|
|
||||||
```
|
|
||||||
python --version
|
|
||||||
```
|
|
||||||
|
|
||||||
If you're good to go, create and activate a virtual environment with:
|
|
||||||
|
|
||||||
```
|
|
||||||
python -m venv venv
|
|
||||||
source ./venv/bin/activate
|
|
||||||
```
|
|
||||||
|
|
||||||
Note that the second `venv` is the name of the folder where to create the
|
|
||||||
virtual environment – you may choose it as you like. Your terminal should
|
|
||||||
now print `(venv)` before the prompt and the `python` executable should be
|
|
||||||
located inside the folder you just created.
|
|
||||||
|
|
||||||
Next, [install Material for MkDocs][2] with `pip`, which will download and
|
|
||||||
install all packages in the `venv` folder you just created, including MkDocs
|
|
||||||
and its dependencies:
|
|
||||||
|
|
||||||
```
|
|
||||||
pip install mkdocs-material
|
|
||||||
```
|
|
||||||
|
|
||||||
Verify that MkDocs and Material for MkDocs were both installed correctly:
|
|
||||||
|
|
||||||
```
|
|
||||||
mkdocs --version
|
|
||||||
mkdocs serve --help
|
|
||||||
```
|
|
||||||
|
|
||||||
MkDocs should list `material` as an option under the `--theme` flag. When
|
|
||||||
you're finished working with MkDocs, you can exit the virtual environment
|
|
||||||
with:
|
|
||||||
|
|
||||||
```
|
|
||||||
deactivate
|
|
||||||
```
|
|
||||||
|
|
||||||
=== "User space"
|
|
||||||
|
|
||||||
Provide the `--user` flag to the install command and `pip` will install the
|
|
||||||
package in a user-site location. While this is not a global installation,
|
|
||||||
it's still not isolated and may lead to problems when you use different
|
|
||||||
versions of Material for MkDocs in other projects:
|
|
||||||
|
|
||||||
```
|
|
||||||
pip install --user mkdocs-material
|
|
||||||
```
|
|
||||||
|
|
||||||
=== "Upgrade Python"
|
|
||||||
|
|
||||||
Upgrade your Python installation by installing Python with [Homebrew][3].
|
|
||||||
This should eliminate a lot of problems you will run into with `pip`. Yet,
|
|
||||||
it's still not an isolated installation which may also lead to the same
|
|
||||||
problems as installing in user space:
|
|
||||||
|
|
||||||
```
|
|
||||||
brew upgrade python
|
|
||||||
```
|
|
||||||
|
|
||||||
[1]: https://docs.python.org/3/tutorial/venv.html
|
|
||||||
[2]: getting-started.md#with-pip-recommended
|
|
||||||
[3]: https://brew.sh/
|
|
@ -2,7 +2,7 @@
|
|||||||
template: overrides/main.html
|
template: overrides/main.html
|
||||||
---
|
---
|
||||||
|
|
||||||
# Upgrading
|
# How to upgrade
|
||||||
|
|
||||||
Upgrade to the latest version with:
|
Upgrade to the latest version with:
|
||||||
|
|
||||||
@ -10,7 +10,7 @@ Upgrade to the latest version with:
|
|||||||
pip install --upgrade mkdocs-material
|
pip install --upgrade mkdocs-material
|
||||||
```
|
```
|
||||||
|
|
||||||
Inspect the currently installed version with:
|
Show the currently installed version with:
|
||||||
|
|
||||||
```
|
```
|
||||||
pip show mkdocs-material
|
pip show mkdocs-material
|
File diff suppressed because one or more lines are too long
22
mkdocs.yml
22
mkdocs.yml
@ -91,18 +91,7 @@ plugins:
|
|||||||
- redirects:
|
- redirects:
|
||||||
redirect_maps:
|
redirect_maps:
|
||||||
changelog/insiders.md: insiders/changelog.md
|
changelog/insiders.md: insiders/changelog.md
|
||||||
extensions/admonition.md: reference/admonitions.md
|
upgrading.md: upgrade.md
|
||||||
extensions/codehilite.md: reference/code-blocks.md
|
|
||||||
extensions/footnotes.md: reference/footnotes.md
|
|
||||||
extensions/metadata.md: reference/meta-tags.md
|
|
||||||
extensions/permalinks.md: setup/setting-up-navigation.md #permalink
|
|
||||||
extensions/pymdown.md: reference/admonitions.md
|
|
||||||
plugins/revision-date.md: setup/adding-a-git-repository.md #revision-date
|
|
||||||
plugins/search.md: setup/setting-up-site-search.md
|
|
||||||
releases/4.md: upgrading.md #upgrading-from-4x-to-5x
|
|
||||||
releases/5.md: upgrading.md #upgrading-from-3x-to-4x
|
|
||||||
releases/changelog.md: changelog.md
|
|
||||||
setup/adding-social-links.md: setup/setting-up-the-footer.md
|
|
||||||
sponsorship.md: insiders/index.md
|
sponsorship.md: insiders/index.md
|
||||||
- minify:
|
- minify:
|
||||||
minify_html: true
|
minify_html: true
|
||||||
@ -174,13 +163,10 @@ nav:
|
|||||||
- Creating your site: creating-your-site.md
|
- Creating your site: creating-your-site.md
|
||||||
- Publishing your site: publishing-your-site.md
|
- Publishing your site: publishing-your-site.md
|
||||||
- Customization: customization.md
|
- Customization: customization.md
|
||||||
- Troubleshooting: troubleshooting.md
|
|
||||||
- Data privacy: data-privacy.md
|
|
||||||
- License: license.md
|
- License: license.md
|
||||||
- Releases:
|
- Changelog:
|
||||||
- Changelog: changelog.md
|
- changelog/index.md
|
||||||
- Upgrade guide: upgrading.md
|
- How to upgrade: upgrade.md
|
||||||
- Deprecations: deprecations.md
|
|
||||||
- Setup:
|
- Setup:
|
||||||
- Changing the colors: setup/changing-the-colors.md
|
- Changing the colors: setup/changing-the-colors.md
|
||||||
- Changing the fonts: setup/changing-the-fonts.md
|
- Changing the fonts: setup/changing-the-fonts.md
|
||||||
|
@ -78,7 +78,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
<!-- Theme-related stylesheets -->
|
<!-- Theme-related style sheets -->
|
||||||
{% block styles %}
|
{% block styles %}
|
||||||
<link rel="stylesheet" href="{{ 'assets/stylesheets/main.css' | url }}" />
|
<link rel="stylesheet" href="{{ 'assets/stylesheets/main.css' | url }}" />
|
||||||
|
|
||||||
@ -136,7 +136,7 @@
|
|||||||
/>
|
/>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<!-- Custom stylesheets -->
|
<!-- Custom style sheets -->
|
||||||
{% for path in config["extra_css"] %}
|
{% for path in config["extra_css"] %}
|
||||||
<link rel="stylesheet" href="{{ path | url }}" />
|
<link rel="stylesheet" href="{{ path | url }}" />
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
<!-- Custom front matter -->
|
<!-- Custom front matter -->
|
||||||
{% block extrahead %}
|
{% block extrahead %}
|
||||||
|
|
||||||
<!-- Extra stylesheets (can't be set in mkdocs.yml due to content hash) -->
|
<!-- Extra style sheets (can't be set in mkdocs.yml due to content hash) -->
|
||||||
<link
|
<link
|
||||||
rel="stylesheet"
|
rel="stylesheet"
|
||||||
href="{{ 'overrides/assets/stylesheets/main.css' | url }}"
|
href="{{ 'overrides/assets/stylesheets/main.css' | url }}"
|
||||||
|
Loading…
Reference in New Issue
Block a user