2016-02-09 23:59:37 +03:00
|
|
|
|
# Getting started
|
|
|
|
|
|
|
|
|
|
## Installation
|
|
|
|
|
|
2017-01-14 21:24:07 +03:00
|
|
|
|
!!! tip "Set up Material using Docker"
|
|
|
|
|
|
|
|
|
|
The official [Docker image][1] for Material comes with all dependencies
|
|
|
|
|
pre-installed and ready-to-use with the latest version published on PyPI,
|
2017-02-25 00:04:52 +03:00
|
|
|
|
packaged in a very small image (28MB compressed).
|
2017-01-14 21:24:07 +03:00
|
|
|
|
|
2017-02-26 20:30:34 +03:00
|
|
|
|
[1]: https://hub.docker.com/r/squidfunk/mkdocs-material/
|
|
|
|
|
|
2016-02-09 23:59:37 +03:00
|
|
|
|
### Installing MkDocs
|
|
|
|
|
|
2017-01-12 22:15:30 +03:00
|
|
|
|
Before installing [MkDocs][2], you need to make sure you have Python and `pip`
|
2016-12-29 19:55:08 +03:00
|
|
|
|
– the Python package manager – up and running. You can verify if you're already
|
2016-02-24 19:31:01 +03:00
|
|
|
|
good to go with the following commands:
|
2016-02-09 23:59:37 +03:00
|
|
|
|
|
|
|
|
|
``` sh
|
|
|
|
|
python --version
|
2016-12-29 19:55:08 +03:00
|
|
|
|
# Python 2.7.13
|
2016-02-09 23:59:37 +03:00
|
|
|
|
pip --version
|
2016-12-29 19:55:08 +03:00
|
|
|
|
# pip 9.0.1
|
2016-02-09 23:59:37 +03:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Installing and verifying MkDocs is as simple as:
|
|
|
|
|
|
|
|
|
|
``` sh
|
|
|
|
|
pip install mkdocs && mkdocs --version
|
2016-12-29 19:55:08 +03:00
|
|
|
|
# mkdocs, version 0.16.0
|
2016-02-09 23:59:37 +03:00
|
|
|
|
```
|
|
|
|
|
|
2017-01-15 13:24:32 +03:00
|
|
|
|
!!! warning "MkDocs version requirements"
|
2016-12-29 19:55:08 +03:00
|
|
|
|
|
|
|
|
|
Material requires MkDocs >= 0.16.
|
|
|
|
|
|
2017-01-12 22:15:30 +03:00
|
|
|
|
Furthermore, it is highly recommended to install [Pygments][3] and the
|
|
|
|
|
[PyMdown Extensions][4] to get the most out of the Material theme:
|
2016-12-29 19:55:08 +03:00
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
pip install pygments
|
|
|
|
|
pip install pymdown-extensions
|
|
|
|
|
```
|
|
|
|
|
|
2017-01-12 22:15:30 +03:00
|
|
|
|
[2]: http://www.mkdocs.org
|
|
|
|
|
[3]: http://pygments.org
|
|
|
|
|
[4]: http://facelessuser.github.io/pymdown-extensions/
|
2016-12-29 19:55:08 +03:00
|
|
|
|
|
2016-02-09 23:59:37 +03:00
|
|
|
|
### Installing Material
|
|
|
|
|
|
2017-01-14 15:43:19 +03:00
|
|
|
|
#### using pip
|
2016-12-29 19:55:08 +03:00
|
|
|
|
|
|
|
|
|
Material can be installed with `pip`:
|
2016-02-09 23:59:37 +03:00
|
|
|
|
|
|
|
|
|
``` sh
|
|
|
|
|
pip install mkdocs-material
|
|
|
|
|
```
|
|
|
|
|
|
2017-01-14 15:43:19 +03:00
|
|
|
|
#### using choco
|
|
|
|
|
|
|
|
|
|
If you're on Windows you can use [Chocolatey][5] to install [Material][6]:
|
|
|
|
|
|
|
|
|
|
``` dos
|
|
|
|
|
choco install mkdocs-material
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
This will also install all required dependencies like [Python][7] and
|
|
|
|
|
[MkDocs][8].
|
|
|
|
|
|
|
|
|
|
[5]: https://chocolatey.org
|
|
|
|
|
[6]: https://chocolatey.org/packages/mkdocs-material
|
2017-01-14 15:44:23 +03:00
|
|
|
|
[7]: https://chocolatey.org/packages/python
|
|
|
|
|
[8]: https://chocolatey.org/packages/mkdocs
|
2017-01-14 15:43:19 +03:00
|
|
|
|
|
|
|
|
|
#### cloning from GitHub
|
2016-12-29 19:55:08 +03:00
|
|
|
|
|
2017-01-12 22:15:30 +03:00
|
|
|
|
Material can also be used without a system-wide installation by cloning the
|
2016-12-29 19:55:08 +03:00
|
|
|
|
repository into a subfolder of your project's root directory:
|
2016-02-09 23:59:37 +03:00
|
|
|
|
|
|
|
|
|
``` sh
|
2016-12-29 19:55:08 +03:00
|
|
|
|
git clone https://github.com/squidfunk/mkdocs-material.git
|
2016-02-09 23:59:37 +03:00
|
|
|
|
```
|
|
|
|
|
|
2017-01-07 22:07:41 +03:00
|
|
|
|
This is especially useful if you want to extend the theme and override some
|
|
|
|
|
parts of the theme. The theme will reside in the folder
|
|
|
|
|
`mkdocs-material/material`.
|
2016-12-29 19:55:08 +03:00
|
|
|
|
|
2017-03-11 20:01:14 +03:00
|
|
|
|
### Troubleshooting
|
|
|
|
|
|
|
|
|
|
!!! warning "Installation on macOS"
|
|
|
|
|
|
|
|
|
|
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
|
2017-03-11 20:36:34 +03:00
|
|
|
|
the adequate permissions. There are two possible solutions for this:
|
2017-03-11 20:01:14 +03:00
|
|
|
|
|
|
|
|
|
1. **Installing in user space** (recommended): Provide the `--user` flag
|
|
|
|
|
to the install command and `pip` will install the package in a user-site
|
|
|
|
|
location. This is the recommended way.
|
|
|
|
|
|
|
|
|
|
2. **Switching to a homebrewed Python**: Upgrade your Python installation
|
|
|
|
|
to a self-contained solution by installing Python with Homebrew. This
|
|
|
|
|
should eliminate a lot of problems you may be having with `pip`.
|
|
|
|
|
|
|
|
|
|
!!! failure "Error: unrecognized theme 'material'"
|
|
|
|
|
|
2017-03-11 20:36:34 +03:00
|
|
|
|
If you run into this error, the most common reason is that you installed
|
2017-03-11 20:01:14 +03:00
|
|
|
|
MkDocs through some package manager (e.g. Homebrew or `apt-get`) and the
|
|
|
|
|
Material theme through `pip`, so both packages end up in different
|
2017-03-11 20:36:34 +03:00
|
|
|
|
locations. MkDocs only checks it's install location for themes.
|
2017-03-11 20:01:14 +03:00
|
|
|
|
|
2016-12-29 19:55:08 +03:00
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
|
|
In order to enable the Material theme just add one of the following lines to
|
|
|
|
|
your `mkdocs.yml`. If you installed Material using pip:
|
2016-02-09 23:59:37 +03:00
|
|
|
|
|
|
|
|
|
``` yaml
|
|
|
|
|
theme: 'material'
|
|
|
|
|
```
|
|
|
|
|
|
2017-01-12 22:15:30 +03:00
|
|
|
|
If you cloned Material from GitHub:
|
2016-02-09 23:59:37 +03:00
|
|
|
|
|
|
|
|
|
``` yaml
|
2016-12-29 19:55:08 +03:00
|
|
|
|
theme_dir: 'mkdocs-material/material'
|
2016-02-09 23:59:37 +03:00
|
|
|
|
```
|
|
|
|
|
|
2017-03-11 20:36:34 +03:00
|
|
|
|
MkDocs includes a development server, so you can review your changes as you go.
|
2017-01-12 22:15:30 +03:00
|
|
|
|
The development server can be started with the following command:
|
2016-02-09 23:59:37 +03:00
|
|
|
|
|
|
|
|
|
``` sh
|
|
|
|
|
mkdocs serve
|
|
|
|
|
```
|
|
|
|
|
|
2017-01-14 14:42:53 +03:00
|
|
|
|
Now you can point your browser to [localhost:8000][9] and the Material theme
|
2017-01-12 22:15:30 +03:00
|
|
|
|
should be visible. From here on, you can start writing your documentation, or
|
|
|
|
|
read on and customize the theme through some options.
|
2017-01-07 22:07:41 +03:00
|
|
|
|
|
2017-01-14 14:42:53 +03:00
|
|
|
|
[9]: http://localhost:8000
|
2016-02-09 23:59:37 +03:00
|
|
|
|
|
|
|
|
|
## Options
|
|
|
|
|
|
|
|
|
|
The Material theme adds some extra variables for configuration via your
|
2017-03-11 20:36:34 +03:00
|
|
|
|
project's `mkdocs.yml`. See the following sections for all available options.
|
2016-02-09 23:59:37 +03:00
|
|
|
|
|
2016-02-24 19:31:01 +03:00
|
|
|
|
### Changing the color palette
|
|
|
|
|
|
|
|
|
|
Material defines a default hue for every primary and accent color on Google's
|
2017-01-14 14:42:53 +03:00
|
|
|
|
Material Design [color palette][10]. This makes it very easy to change the
|
2016-12-29 19:55:08 +03:00
|
|
|
|
overall look of the theme. Just set the primary and accent colors using the
|
|
|
|
|
following variables in your `mkdocs.yml`:
|
2016-02-24 19:31:01 +03:00
|
|
|
|
|
|
|
|
|
``` yaml
|
|
|
|
|
extra:
|
|
|
|
|
palette:
|
|
|
|
|
primary: 'indigo'
|
|
|
|
|
accent: 'light blue'
|
|
|
|
|
```
|
|
|
|
|
|
2017-01-12 22:15:30 +03:00
|
|
|
|
Color names are case-insensitive, but must match the names of the Material
|
|
|
|
|
Design color palette. Valid values are: `red`, `pink`, `purple`, `deep purple`,
|
|
|
|
|
`indigo`, `blue`, `light blue`, `cyan`, `teal`, `green`, `light green`, `lime`,
|
|
|
|
|
`yellow`, `amber`, `orange`, `deep orange`, `brown`, `grey` and `blue grey`.
|
|
|
|
|
The last three colors can only be used as a primary color.
|
2016-12-29 19:55:08 +03:00
|
|
|
|
|
|
|
|
|
If the color is set via this configuration, an additional CSS file that
|
|
|
|
|
defines the color palette is included. If you want to keep things lean, clone
|
2017-01-12 22:15:30 +03:00
|
|
|
|
the repository and recompile the theme with your custom colors set. See the
|
2017-01-14 14:42:53 +03:00
|
|
|
|
guide on [customization][11] for more information.
|
2016-12-29 19:55:08 +03:00
|
|
|
|
|
2017-01-14 14:42:53 +03:00
|
|
|
|
[10]: http://www.materialui.co/colors
|
|
|
|
|
[11]: customization.md
|
2016-12-29 19:55:08 +03:00
|
|
|
|
|
|
|
|
|
#### Primary colors
|
|
|
|
|
|
|
|
|
|
Click on a tile to change the primary color of the theme:
|
|
|
|
|
|
|
|
|
|
<button data-md-color-primary="red">Red</button>
|
|
|
|
|
<button data-md-color-primary="pink">Pink</button>
|
|
|
|
|
<button data-md-color-primary="purple">Purple</button>
|
|
|
|
|
<button data-md-color-primary="deep-purple">Deep Purple</button>
|
|
|
|
|
<button data-md-color-primary="indigo">Indigo</button>
|
|
|
|
|
<button data-md-color-primary="blue">Blue</button>
|
|
|
|
|
<button data-md-color-primary="light-blue">Light Blue</button>
|
|
|
|
|
<button data-md-color-primary="cyan">Cyan</button>
|
|
|
|
|
<button data-md-color-primary="teal">Teal</button>
|
|
|
|
|
<button data-md-color-primary="green">Green</button>
|
|
|
|
|
<button data-md-color-primary="light-green">Light Green</button>
|
|
|
|
|
<button data-md-color-primary="lime">Lime</button>
|
|
|
|
|
<button data-md-color-primary="yellow">Yellow</button>
|
|
|
|
|
<button data-md-color-primary="amber">Amber</button>
|
|
|
|
|
<button data-md-color-primary="orange">Orange</button>
|
|
|
|
|
<button data-md-color-primary="deep-orange">Deep Orange</button>
|
|
|
|
|
<button data-md-color-primary="brown">Brown</button>
|
|
|
|
|
<button data-md-color-primary="grey">Grey</button>
|
|
|
|
|
<button data-md-color-primary="blue-grey">Blue Grey</button>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
var buttons = document.querySelectorAll("button[data-md-color-primary]");
|
|
|
|
|
Array.prototype.forEach.call(buttons, function(button) {
|
|
|
|
|
button.addEventListener("click", function() {
|
|
|
|
|
document.body.dataset.mdColorPrimary = this.dataset.mdColorPrimary;
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
#### Accent colors
|
|
|
|
|
|
|
|
|
|
Click on a tile to change the accent color of the theme:
|
|
|
|
|
|
|
|
|
|
<button data-md-color-accent="red">Red</button>
|
|
|
|
|
<button data-md-color-accent="pink">Pink</button>
|
|
|
|
|
<button data-md-color-accent="purple">Purple</button>
|
|
|
|
|
<button data-md-color-accent="deep-purple">Deep Purple</button>
|
|
|
|
|
<button data-md-color-accent="indigo">Indigo</button>
|
|
|
|
|
<button data-md-color-accent="blue">Blue</button>
|
|
|
|
|
<button data-md-color-accent="light-blue">Light Blue</button>
|
|
|
|
|
<button data-md-color-accent="cyan">Cyan</button>
|
|
|
|
|
<button data-md-color-accent="teal">Teal</button>
|
|
|
|
|
<button data-md-color-accent="green">Green</button>
|
|
|
|
|
<button data-md-color-accent="light-green">Light Green</button>
|
|
|
|
|
<button data-md-color-accent="lime">Lime</button>
|
|
|
|
|
<button data-md-color-accent="yellow">Yellow</button>
|
|
|
|
|
<button data-md-color-accent="amber">Amber</button>
|
|
|
|
|
<button data-md-color-accent="orange">Orange</button>
|
|
|
|
|
<button data-md-color-accent="deep-orange">Deep Orange</button>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
var buttons = document.querySelectorAll("button[data-md-color-accent]");
|
|
|
|
|
Array.prototype.forEach.call(buttons, function(button) {
|
|
|
|
|
button.addEventListener("click", function() {
|
|
|
|
|
document.body.dataset.mdColorAccent = this.dataset.mdColorAccent;
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
</script>
|
2016-02-24 19:31:01 +03:00
|
|
|
|
|
2016-02-17 20:08:11 +03:00
|
|
|
|
### Changing the font family
|
2016-02-09 23:59:37 +03:00
|
|
|
|
|
2017-01-14 14:42:53 +03:00
|
|
|
|
Material uses the [Roboto font family][12] by default, specifically the regular
|
2017-01-07 22:07:41 +03:00
|
|
|
|
sans-serif type for text and the `monospaced` type for code. Both fonts are
|
2017-01-14 14:42:53 +03:00
|
|
|
|
loaded from [Google Fonts][13] and can easily be changed to other fonts, like
|
|
|
|
|
for example the [Ubuntu font family][14]:
|
2016-02-09 23:59:37 +03:00
|
|
|
|
|
|
|
|
|
``` yaml
|
|
|
|
|
extra:
|
2016-02-17 20:08:11 +03:00
|
|
|
|
font:
|
2016-12-29 19:55:08 +03:00
|
|
|
|
text: 'Ubuntu'
|
|
|
|
|
code: 'Ubuntu Mono'
|
2016-02-17 20:08:11 +03:00
|
|
|
|
```
|
|
|
|
|
|
2017-01-07 22:07:41 +03:00
|
|
|
|
The text font will be loaded in font-weights 400 and **700**, the `monospaced`
|
2016-02-24 19:31:01 +03:00
|
|
|
|
font in regular weight. If you want to load fonts from other destinations or
|
2017-03-11 20:36:34 +03:00
|
|
|
|
don't want to use the Google Fonts loading magic, just set `font` to `false`:
|
2016-02-17 20:08:11 +03:00
|
|
|
|
|
|
|
|
|
``` yaml
|
|
|
|
|
extra:
|
2017-03-11 20:36:34 +03:00
|
|
|
|
font: false
|
2016-02-09 23:59:37 +03:00
|
|
|
|
```
|
|
|
|
|
|
2017-01-14 14:42:53 +03:00
|
|
|
|
[12]: https://fonts.google.com/specimen/Roboto
|
2017-02-25 00:53:12 +03:00
|
|
|
|
[13]: https://fonts.google.com
|
2017-01-14 14:42:53 +03:00
|
|
|
|
[14]: https://fonts.google.com/specimen/Ubuntu
|
2016-12-29 19:55:08 +03:00
|
|
|
|
|
2017-03-11 19:24:03 +03:00
|
|
|
|
### Adding a source repository
|
|
|
|
|
|
|
|
|
|
To include a link to the repository of your project within your documentation,
|
|
|
|
|
set the following variables via your project's `mkdocs.yml`:
|
|
|
|
|
|
|
|
|
|
``` yaml
|
|
|
|
|
repo_name: 'my-github-handle/my-project'
|
|
|
|
|
repo_url: 'https://github.com/my-github-handle/my-project'
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Material will render the name of the repository next to the search bar on
|
2017-03-11 20:36:34 +03:00
|
|
|
|
big screens and as part of the main navigation drawer on smaller screen sizes.
|
2017-03-11 19:24:03 +03:00
|
|
|
|
Furthermore, if `repo_url` points to a GitHub, BitBucket or GitLab repository,
|
2017-03-11 20:36:34 +03:00
|
|
|
|
the respective service logo will be shown next to the name of the repository.
|
2017-03-11 19:24:03 +03:00
|
|
|
|
Additionally, for GitHub, the number of stars and forks is shown.
|
|
|
|
|
|
|
|
|
|
!!! warning "Why is there an edit button at the top of every article?"
|
|
|
|
|
|
|
|
|
|
If the `repo_url` is set to a GitHub or BitBucket repository, and the
|
2017-03-11 20:36:34 +03:00
|
|
|
|
`repo_name` is set to *GitHub* or *BitBucket* (implied by default), an
|
2017-03-11 19:24:03 +03:00
|
|
|
|
edit button will appear at the top of every article. This is the automatic
|
|
|
|
|
behavior that MkDocs implements. See the [MkDocs documentation][15] on more
|
|
|
|
|
guidance regarding the `edit_uri` attribute, which defines whether the edit
|
|
|
|
|
button is show or not.
|
|
|
|
|
|
|
|
|
|
[15]: http://www.mkdocs.org/user-guide/configuration/#edit_uri
|
|
|
|
|
|
2016-12-29 19:55:08 +03:00
|
|
|
|
### Adding a logo
|
2016-02-24 19:31:01 +03:00
|
|
|
|
|
2016-12-29 19:55:08 +03:00
|
|
|
|
Material makes it easy to add your logo. Your logo should have rectangular
|
|
|
|
|
shape with a minimum resolution of 128x128, leave some room towards the edges
|
|
|
|
|
and be composed of high contrast areas on a transparent ground, as it will be
|
|
|
|
|
placed on the colored header bar and drawer. Simply create the folder
|
|
|
|
|
`docs/images`, add your logo and embed it with:
|
2016-02-24 19:31:01 +03:00
|
|
|
|
|
|
|
|
|
``` yaml
|
|
|
|
|
extra:
|
2016-12-29 19:55:08 +03:00
|
|
|
|
logo: 'images/logo.svg'
|
2016-02-24 19:31:01 +03:00
|
|
|
|
```
|
|
|
|
|
|
2016-12-29 19:55:08 +03:00
|
|
|
|
### Adding social links
|
2016-02-09 23:59:37 +03:00
|
|
|
|
|
2016-12-29 19:55:08 +03:00
|
|
|
|
If you want to link your social accounts, the Material theme provides an easy
|
|
|
|
|
way for doing this in the footer of the documentation using the automatically
|
2017-03-11 19:24:03 +03:00
|
|
|
|
included [FontAwesome][16] webfont. The syntax is simple – the `type` must
|
2017-01-12 22:15:30 +03:00
|
|
|
|
denote the name of the social service, e.g. `github`, `twitter` or `linkedin`
|
|
|
|
|
and the `link` must contain the URL you want to link to:
|
2016-02-09 23:59:37 +03:00
|
|
|
|
|
|
|
|
|
``` yaml
|
|
|
|
|
extra:
|
2016-12-29 19:55:08 +03:00
|
|
|
|
social:
|
|
|
|
|
- type: 'github'
|
|
|
|
|
link: 'https://github.com/squidfunk'
|
|
|
|
|
- type: 'twitter'
|
|
|
|
|
link: 'https://twitter.com/squidfunk'
|
|
|
|
|
- type: 'linkedin'
|
|
|
|
|
link: 'https://de.linkedin.com/in/martin-donath-20a95039'
|
2016-02-09 23:59:37 +03:00
|
|
|
|
```
|
|
|
|
|
|
2017-01-12 22:15:30 +03:00
|
|
|
|
The links are generated in order and the `type` of the links must match the
|
|
|
|
|
name of the FontAwesome glyph. The `fa` is automatically added, so `github`
|
|
|
|
|
will result in `fa fa-github`.
|
2016-12-29 19:55:08 +03:00
|
|
|
|
|
2017-03-11 19:24:03 +03:00
|
|
|
|
[16]: http://fontawesome.io/icons/
|
2016-12-29 19:55:08 +03:00
|
|
|
|
|
2016-03-12 15:21:06 +03:00
|
|
|
|
### Google Analytics integration
|
|
|
|
|
|
2016-12-29 19:55:08 +03:00
|
|
|
|
MkDocs makes it easy to integrate site tracking with Google Analytics.
|
|
|
|
|
Besides basic tracking, clicks on all outgoing links can be tracked as well as
|
|
|
|
|
how site search is used. Tracking can be activated in your project's
|
|
|
|
|
`mkdocs.yml`:
|
2016-03-12 15:21:06 +03:00
|
|
|
|
|
|
|
|
|
``` yaml
|
|
|
|
|
google_analytics:
|
|
|
|
|
- 'UA-XXXXXXXX-X'
|
|
|
|
|
- 'auto'
|
|
|
|
|
```
|
|
|
|
|
|
2017-02-25 00:53:12 +03:00
|
|
|
|
### Disqus integation
|
|
|
|
|
|
2017-03-11 19:24:03 +03:00
|
|
|
|
Material for MkDocs is integrated with [Disqus][17], so if you want to add a
|
2017-02-25 00:53:12 +03:00
|
|
|
|
comments section to your documentation set the shortname of your Disqus project
|
|
|
|
|
in your `mkdocs.yml`:
|
|
|
|
|
|
|
|
|
|
``` yaml
|
|
|
|
|
extra:
|
|
|
|
|
disqus: 'your-disqus-shortname'
|
|
|
|
|
```
|
|
|
|
|
|
2017-03-11 20:36:34 +03:00
|
|
|
|
A new entry at the bottom of the table of contents is generated that is linking
|
|
|
|
|
to the comments section. The necessary JavaScript is automatically included.
|
2017-02-25 00:53:12 +03:00
|
|
|
|
|
2017-03-11 19:24:03 +03:00
|
|
|
|
[17]: https://disqus.com
|
2017-02-25 00:53:12 +03:00
|
|
|
|
|
2017-03-11 19:24:03 +03:00
|
|
|
|
### Localization
|
2017-01-07 20:54:03 +03:00
|
|
|
|
|
2017-03-11 19:24:03 +03:00
|
|
|
|
Material for MkDocs supports internationalization (i18n). In order to translate
|
|
|
|
|
the labels (e.g. *Previous* and *Next* in the footer), you can override the
|
2017-03-11 20:36:34 +03:00
|
|
|
|
file `partials/language.html` and provide your own translations inside the
|
2017-03-11 19:24:03 +03:00
|
|
|
|
macro `t`:
|
2017-01-07 20:54:03 +03:00
|
|
|
|
|
|
|
|
|
``` jinja
|
|
|
|
|
{% macro t(key) %}{{ {
|
|
|
|
|
"edit.link.title": "Edit this page",
|
|
|
|
|
"footer.previous": "Previous",
|
|
|
|
|
"footer.next": "Next",
|
2017-03-11 19:24:03 +03:00
|
|
|
|
"meta.comments": "Comments",
|
|
|
|
|
"meta.source": "Source",
|
2017-01-07 20:54:03 +03:00
|
|
|
|
"search.placeholder": "Search",
|
|
|
|
|
"source.link.title": "Go to repository",
|
|
|
|
|
"toc.title": "Table of contents"
|
|
|
|
|
}[key] }}{% endmacro %}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Just copy the file from the original theme and make your adjustments. See the
|
2017-03-11 19:24:03 +03:00
|
|
|
|
section on [overriding partials][18] and the general guide on
|
|
|
|
|
[theme extension][19] in the customization guide.
|
2017-01-07 22:07:41 +03:00
|
|
|
|
|
2017-03-11 19:24:03 +03:00
|
|
|
|
[18]: customization.md#overriding-partials
|
|
|
|
|
[19]: customization.md#extending-the-theme
|
2017-01-07 20:54:03 +03:00
|
|
|
|
|
2017-03-11 20:01:14 +03:00
|
|
|
|
### Tabs
|
|
|
|
|
|
|
|
|
|
From version 1.1.0 on, Material supports another layer on top of the main
|
|
|
|
|
navigation for larger screens in the form of tabs. This is especially useful
|
|
|
|
|
for larger documentation projects with a few top-level sections. Tabs can be
|
|
|
|
|
enabled by setting the respective feature flag to true:
|
|
|
|
|
|
|
|
|
|
``` yaml
|
|
|
|
|
extra:
|
|
|
|
|
feature:
|
|
|
|
|
tabs: true
|
|
|
|
|
```
|
|
|
|
|
|
2016-02-09 23:59:37 +03:00
|
|
|
|
### More advanced customization
|
|
|
|
|
|
2016-02-24 19:31:01 +03:00
|
|
|
|
If you want to change the general appearance of the Material theme, see
|
2017-03-11 19:24:03 +03:00
|
|
|
|
[this article][20] for more information on advanced customization.
|
2017-01-07 22:07:41 +03:00
|
|
|
|
|
2017-03-11 19:24:03 +03:00
|
|
|
|
[20]: customization.md
|
2016-02-09 23:59:37 +03:00
|
|
|
|
|
|
|
|
|
## Extensions
|
|
|
|
|
|
2017-03-11 19:24:03 +03:00
|
|
|
|
MkDocs supports several [Markdown extensions][21]. The following extensions
|
2017-01-07 22:07:41 +03:00
|
|
|
|
are not enabled by default (see the link for which are enabled by default)
|
|
|
|
|
but highly recommended, so they should be switched on at all times:
|
2016-02-09 23:59:37 +03:00
|
|
|
|
|
|
|
|
|
``` yaml
|
|
|
|
|
markdown_extensions:
|
|
|
|
|
- admonition
|
2016-12-29 19:55:08 +03:00
|
|
|
|
- codehilite(guess_lang=false)
|
|
|
|
|
- toc(permalink=true)
|
2016-02-09 23:59:37 +03:00
|
|
|
|
```
|
|
|
|
|
|
2016-12-29 19:55:08 +03:00
|
|
|
|
For more information, see the following list of extensions supported by the
|
|
|
|
|
Material theme including more information regarding installation and usage:
|
2016-02-21 20:30:49 +03:00
|
|
|
|
|
2017-03-11 19:24:03 +03:00
|
|
|
|
* [Admonition][22]
|
|
|
|
|
* [Codehilite][23]
|
|
|
|
|
* [Footnotes][24]
|
|
|
|
|
* [Metadata][25]
|
|
|
|
|
* [Permalinks][26]
|
|
|
|
|
* [PyMdown Extensions][27]
|
|
|
|
|
|
|
|
|
|
[21]: http://www.mkdocs.org/user-guide/writing-your-docs/#markdown-extensions
|
|
|
|
|
[22]: extensions/admonition.md
|
|
|
|
|
[23]: extensions/codehilite.md
|
|
|
|
|
[24]: extensions/footnotes.md
|
|
|
|
|
[25]: extensions/metadata.md
|
|
|
|
|
[26]: extensions/permalinks.md
|
|
|
|
|
[27]: extensions/pymdown.md
|
2016-02-09 23:59:37 +03:00
|
|
|
|
|
|
|
|
|
## Full example
|
|
|
|
|
|
2016-08-07 19:01:56 +03:00
|
|
|
|
Below is a full example configuration for a `mkdocs.yml`:
|
2016-02-09 23:59:37 +03:00
|
|
|
|
|
|
|
|
|
``` yaml
|
|
|
|
|
# Project information
|
|
|
|
|
site_name: 'My Project'
|
|
|
|
|
site_description: 'A short description of my project'
|
|
|
|
|
site_author: 'John Doe'
|
2016-02-16 19:04:03 +03:00
|
|
|
|
site_url: 'https://my-github-handle.github.io/my-project'
|
2016-02-09 23:59:37 +03:00
|
|
|
|
|
|
|
|
|
# Repository
|
2017-03-11 19:24:03 +03:00
|
|
|
|
repo_name: 'my-github-handle/my-project'
|
2016-02-09 23:59:37 +03:00
|
|
|
|
repo_url: 'https://github.com/my-github-handle/my-project'
|
|
|
|
|
|
|
|
|
|
# Copyright
|
2017-02-25 00:53:12 +03:00
|
|
|
|
copyright: 'Copyright © 2016 - 2017 John Doe'
|
2016-02-09 23:59:37 +03:00
|
|
|
|
|
|
|
|
|
# Documentation and theme
|
|
|
|
|
theme: 'material'
|
|
|
|
|
|
|
|
|
|
# Options
|
|
|
|
|
extra:
|
2016-12-29 19:55:08 +03:00
|
|
|
|
logo: 'images/logo.svg'
|
2016-02-24 19:31:01 +03:00
|
|
|
|
palette:
|
|
|
|
|
primary: 'indigo'
|
2016-12-29 19:55:08 +03:00
|
|
|
|
accent: 'indigo'
|
2016-02-17 20:08:11 +03:00
|
|
|
|
font:
|
|
|
|
|
text: 'Roboto'
|
|
|
|
|
code: 'Roboto Mono'
|
2016-12-29 19:55:08 +03:00
|
|
|
|
social:
|
|
|
|
|
- type: 'github'
|
2017-02-25 00:53:12 +03:00
|
|
|
|
link: 'https://github.com/john-doe'
|
2016-12-29 19:55:08 +03:00
|
|
|
|
- type: 'twitter'
|
2017-02-25 00:53:12 +03:00
|
|
|
|
link: 'https://twitter.com/jonh-doe'
|
2016-12-29 19:55:08 +03:00
|
|
|
|
- type: 'linkedin'
|
2017-02-25 00:53:12 +03:00
|
|
|
|
link: 'https://de.linkedin.com/in/john-doe'
|
2016-02-09 23:59:37 +03:00
|
|
|
|
|
2016-03-12 15:21:06 +03:00
|
|
|
|
# Google Analytics
|
|
|
|
|
google_analytics:
|
|
|
|
|
- 'UA-XXXXXXXX-X'
|
|
|
|
|
- 'auto'
|
|
|
|
|
|
2016-02-09 23:59:37 +03:00
|
|
|
|
# Extensions
|
|
|
|
|
markdown_extensions:
|
|
|
|
|
- admonition
|
2016-12-29 19:55:08 +03:00
|
|
|
|
- codehilite(guess_lang=false)
|
|
|
|
|
- toc(permalink=true)
|
2016-02-09 23:59:37 +03:00
|
|
|
|
```
|