2021-03-21 16:04:29 +03:00
|
|
|
|
---
|
2021-11-07 20:59:18 +03:00
|
|
|
|
title: Getting started with Insiders
|
2021-03-21 16:04:29 +03:00
|
|
|
|
---
|
|
|
|
|
|
2021-11-07 20:59:18 +03:00
|
|
|
|
# Getting started with Insiders
|
2021-03-21 16:04:29 +03:00
|
|
|
|
|
2021-11-07 20:59:18 +03:00
|
|
|
|
Material for MkDocs Insiders is a compatible drop-in replacement for Material
|
2023-02-16 18:21:11 +03:00
|
|
|
|
for MkDocs, and can be installed similarly using [`pip`][pip],
|
2023-09-14 20:09:18 +03:00
|
|
|
|
[`docker`][docker] or [`git`][git]. Note that in order to access the Insiders
|
2021-11-07 20:59:18 +03:00
|
|
|
|
repository, you need to [become an eligible sponsor] of @squidfunk on GitHub.
|
2021-03-21 16:04:29 +03:00
|
|
|
|
|
2021-10-10 23:32:32 +03:00
|
|
|
|
[pip]: #with-pip
|
|
|
|
|
[docker]: #with-docker
|
|
|
|
|
[git]: #with-git
|
2021-11-07 20:23:01 +03:00
|
|
|
|
[become an eligible sponsor]: index.md#how-to-become-a-sponsor
|
2021-03-21 16:04:29 +03:00
|
|
|
|
|
2021-03-21 19:14:32 +03:00
|
|
|
|
## Requirements
|
2021-03-21 16:04:29 +03:00
|
|
|
|
|
2021-11-07 20:23:01 +03:00
|
|
|
|
After you've been added to the list of collaborators and accepted the
|
2021-11-07 20:59:18 +03:00
|
|
|
|
repository invitation, the next step is to create a [personal access token] for
|
2023-09-14 20:09:18 +03:00
|
|
|
|
your GitHub account in order to access the Insiders repository programmatically
|
2021-11-07 20:59:18 +03:00
|
|
|
|
(from the command line or GitHub Actions workflows):
|
2021-03-21 16:04:29 +03:00
|
|
|
|
|
2021-10-10 13:19:14 +03:00
|
|
|
|
1. Go to https://github.com/settings/tokens
|
2021-11-07 20:23:01 +03:00
|
|
|
|
2. Click on [Generate a new token]
|
|
|
|
|
3. Enter a name and select the [`repo`][scopes] scope
|
2021-10-10 13:19:14 +03:00
|
|
|
|
4. Generate the token and store it in a safe place
|
2021-03-21 16:04:29 +03:00
|
|
|
|
|
2021-11-07 20:23:01 +03:00
|
|
|
|
[personal access token]: https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token
|
|
|
|
|
[Generate a new token]: https://github.com/settings/tokens/new
|
|
|
|
|
[scopes]: https://docs.github.com/en/developers/apps/scopes-for-oauth-apps#available-scopes
|
2021-03-21 16:04:29 +03:00
|
|
|
|
|
2021-03-21 19:14:32 +03:00
|
|
|
|
## Installation
|
2021-03-21 16:04:29 +03:00
|
|
|
|
|
2021-03-21 19:14:32 +03:00
|
|
|
|
### with pip
|
2021-03-21 16:04:29 +03:00
|
|
|
|
|
2021-03-21 19:14:32 +03:00
|
|
|
|
Material for MkDocs Insiders can be installed with `pip`:
|
2021-03-21 16:04:29 +03:00
|
|
|
|
|
2021-03-21 19:14:32 +03:00
|
|
|
|
``` sh
|
|
|
|
|
pip install git+https://${GH_TOKEN}@github.com/squidfunk/mkdocs-material-insiders.git
|
|
|
|
|
```
|
2021-03-21 16:04:29 +03:00
|
|
|
|
|
2021-03-21 19:14:32 +03:00
|
|
|
|
The `GH_TOKEN` environment variable must be set to the value of the personal
|
|
|
|
|
access token you generated in the previous step. Note that the personal access
|
|
|
|
|
token must be kept secret at all times, as it allows the owner to access your
|
|
|
|
|
private repositories.
|
2021-03-21 16:04:29 +03:00
|
|
|
|
|
|
|
|
|
### with docker
|
|
|
|
|
|
2021-06-01 09:51:54 +03:00
|
|
|
|
In case you want to use Material for MkDocs Insiders from within Docker, some
|
|
|
|
|
additional steps are necessary. While we cannot provide a hosted Docker image
|
2021-11-07 20:23:01 +03:00
|
|
|
|
for Insiders[^2], [GitHub Container Registry] allows for simple and
|
2021-03-21 19:14:32 +03:00
|
|
|
|
comfortable self-hosting:
|
|
|
|
|
|
2021-11-07 20:23:01 +03:00
|
|
|
|
1. [Fork the Insiders repository]
|
|
|
|
|
2. Enable [GitHub Actions] on your fork[^3]
|
|
|
|
|
3. Create a new personal access token[^4]
|
2021-10-10 13:19:14 +03:00
|
|
|
|
1. Go to https://github.com/settings/tokens
|
2021-11-07 20:23:01 +03:00
|
|
|
|
2. Click on [Generate a new token]
|
|
|
|
|
3. Enter a name and select the [`write:packages`][scopes] scope
|
2021-10-10 13:19:14 +03:00
|
|
|
|
4. Generate the token and store it in a safe place
|
2021-11-07 20:23:01 +03:00
|
|
|
|
4. Add a [GitHub Actions secret] on your fork
|
2021-10-10 13:19:14 +03:00
|
|
|
|
1. Set the name to `GHCR_TOKEN`
|
|
|
|
|
2. Set the value to the personal access token created in the previous step
|
2021-11-07 20:23:01 +03:00
|
|
|
|
5. [Create a new release] to build and publish the Docker image
|
|
|
|
|
6. Install [Pull App] on your fork to stay in-sync with upstream
|
2021-03-21 19:14:32 +03:00
|
|
|
|
|
2021-11-07 20:23:01 +03:00
|
|
|
|
The [`publish`][publish] workflow[^5] is automatically run when a new tag
|
2023-09-14 20:09:18 +03:00
|
|
|
|
(release) is created. When a new Insiders version is released on the upstream
|
2021-11-07 20:23:01 +03:00
|
|
|
|
repository, the [Pull App] will create a pull request with the changes and
|
|
|
|
|
pull in the new tag, which is picked up by the [`publish`][publish] workflow
|
|
|
|
|
that builds and publishes the Docker image automatically to your private
|
|
|
|
|
registry.
|
2021-03-21 19:14:32 +03:00
|
|
|
|
|
|
|
|
|
Now, you should be able to pull the Docker image from your private registry:
|
2021-03-21 16:04:29 +03:00
|
|
|
|
|
2021-03-21 19:14:32 +03:00
|
|
|
|
```
|
|
|
|
|
docker login -u ${GH_USERNAME} -p ${GHCR_TOKEN} ghcr.io
|
|
|
|
|
docker pull ghcr.io/${GH_USERNAME}/mkdocs-material-insiders
|
|
|
|
|
```
|
2021-03-21 16:04:29 +03:00
|
|
|
|
|
2023-06-29 17:30:33 +03:00
|
|
|
|
Should you wish to add additional plugins to the insiders container image, follow the steps
|
|
|
|
|
outlined in the [Getting Started guide](../getting-started.md#with-docker).
|
|
|
|
|
|
2021-11-07 20:23:01 +03:00
|
|
|
|
[^2]:
|
2021-03-21 19:14:32 +03:00
|
|
|
|
Earlier, Insiders provided a dedicated Docker image which was available to
|
|
|
|
|
all sponsors. On March 21, 2021, the image was deprecated for the reasons
|
2021-06-01 09:50:44 +03:00
|
|
|
|
outlined and discussed in #2442. It was removed on June 1, 2021.
|
2021-03-21 16:04:29 +03:00
|
|
|
|
|
2021-11-07 20:23:01 +03:00
|
|
|
|
[^3]:
|
2023-08-30 19:22:27 +03:00
|
|
|
|
When forking a repository, GitHub will disable all workflows. While this
|
2021-03-21 19:14:32 +03:00
|
|
|
|
is a reasonable default setting, you need to enable GitHub Actions to be
|
|
|
|
|
able to automatically build and publish a Docker image on
|
2021-11-07 20:23:01 +03:00
|
|
|
|
[GitHub Container Registry].
|
2021-03-21 16:04:29 +03:00
|
|
|
|
|
2021-11-07 20:23:01 +03:00
|
|
|
|
[^4]:
|
2021-03-21 19:14:32 +03:00
|
|
|
|
While you could just add the `write:packages` scope to the personal access
|
|
|
|
|
token created to access the Insiders repository, it's safer to create a
|
|
|
|
|
dedicated token which you'll only use for publishing the Docker image.
|
2021-03-21 16:04:29 +03:00
|
|
|
|
|
2021-11-07 20:23:01 +03:00
|
|
|
|
[^5]:
|
2022-09-11 20:25:40 +03:00
|
|
|
|
The Insiders repository contains two GitHub Actions workflows:
|
2021-03-21 16:04:29 +03:00
|
|
|
|
|
2021-03-21 19:14:32 +03:00
|
|
|
|
- `build.yml` – Build and lint the project (disabled on forks)
|
|
|
|
|
- `publish.yml` – Build and publish the Docker image
|
2021-03-21 16:04:29 +03:00
|
|
|
|
|
|
|
|
|
### with git
|
|
|
|
|
|
2021-03-21 19:14:32 +03:00
|
|
|
|
Of course, you can use Material for MkDocs Insiders directly from `git`:
|
2021-03-21 16:04:29 +03:00
|
|
|
|
|
2021-03-21 19:14:32 +03:00
|
|
|
|
```
|
|
|
|
|
git clone git@github.com:squidfunk/mkdocs-material-insiders.git mkdocs-material
|
|
|
|
|
```
|
2021-03-21 16:04:29 +03:00
|
|
|
|
|
|
|
|
|
The theme will reside in the folder `mkdocs-material/material`. When cloning
|
2021-05-30 17:01:48 +03:00
|
|
|
|
from `git`, the theme must be installed, so MkDocs can find the built-in
|
|
|
|
|
plugins:
|
2021-03-21 16:04:29 +03:00
|
|
|
|
|
|
|
|
|
```
|
2021-05-30 17:01:48 +03:00
|
|
|
|
pip install -e mkdocs-material
|
2021-03-21 16:04:29 +03:00
|
|
|
|
```
|
|
|
|
|
|
2021-11-07 20:23:01 +03:00
|
|
|
|
[GitHub Container Registry]: https://docs.github.com/en/packages/guides/about-github-container-registry
|
|
|
|
|
[Fork the Insiders repository]: https://github.com/squidfunk/mkdocs-material-insiders/fork
|
|
|
|
|
[GitHub Actions]: https://docs.github.com/en/github/administering-a-repository/disabling-or-limiting-github-actions-for-a-repository
|
|
|
|
|
[packages scope]: https://docs.github.com/en/developers/apps/scopes-for-oauth-apps#available-scopes
|
|
|
|
|
[GitHub Actions secret]: https://docs.github.com/en/actions/reference/encrypted-secrets#creating-encrypted-secrets-for-a-repository
|
|
|
|
|
[Create a new release]: https://docs.github.com/en/github/administering-a-repository/managing-releases-in-a-repository#creating-a-release
|
|
|
|
|
[Pull App]: https://github.com/apps/pull
|
|
|
|
|
[publish]: https://github.com/squidfunk/mkdocs-material-insiders/blob/master/.github/workflows/publish.yml
|
|
|
|
|
|
2021-12-27 20:10:44 +03:00
|
|
|
|
## Upgrading
|
|
|
|
|
|
|
|
|
|
When upgrading Insiders, you should always check the version of Material for
|
|
|
|
|
MkDocs which makes up the first part of the version qualifier, e.g.Insiders
|
|
|
|
|
`4.x.x` is currently based on `8.x.x`:
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
8.x.x-insiders-4.x.x
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
If the major version increased, it's a good idea to consult the [upgrade
|
|
|
|
|
guide] and go through the steps to ensure your configuration is up to date and
|
|
|
|
|
all necessary changes have been made. If you installed Insiders via `pip`, you
|
|
|
|
|
can upgrade your installation with the following command:
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
pip install --upgrade git+https://${GH_TOKEN}@github.com/squidfunk/mkdocs-material-insiders.git
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
[upgrade guide]: ../upgrade.md
|
|
|
|
|
|
2023-09-11 18:18:58 +03:00
|
|
|
|
## Built-in plugins
|
2021-11-07 20:59:18 +03:00
|
|
|
|
|
2023-09-11 18:18:58 +03:00
|
|
|
|
When you're using built-in plugins that are solely available via Insiders,
|
|
|
|
|
outside contributors won't be able to build your documentation project on their
|
|
|
|
|
local machine. This is the reason why we developed the [built-in group plugin]
|
2023-09-14 20:09:18 +03:00
|
|
|
|
that allows to conditionally load plugins:
|
2021-11-07 20:59:18 +03:00
|
|
|
|
|
2023-09-11 18:18:58 +03:00
|
|
|
|
``` yaml
|
|
|
|
|
plugins:
|
2023-09-14 20:09:18 +03:00
|
|
|
|
- search
|
|
|
|
|
- social
|
|
|
|
|
|
|
|
|
|
# CI=1 mkdocs build
|
2023-09-11 18:18:58 +03:00
|
|
|
|
- group:
|
|
|
|
|
enabled: !ENV CI
|
2023-09-14 20:09:18 +03:00
|
|
|
|
plugins:
|
|
|
|
|
- git-revision-date-localized
|
|
|
|
|
- git-committers
|
|
|
|
|
|
|
|
|
|
# INSIDERS=1 mkdocs build
|
|
|
|
|
- group:
|
|
|
|
|
enabled: !ENV INSIDERS
|
2023-09-11 18:18:58 +03:00
|
|
|
|
plugins:
|
|
|
|
|
- optimize
|
2023-09-14 20:09:18 +03:00
|
|
|
|
- privacy
|
2023-09-11 18:18:58 +03:00
|
|
|
|
```
|
2021-11-07 20:59:18 +03:00
|
|
|
|
|
2023-09-14 20:09:18 +03:00
|
|
|
|
Of course, you can also enable both groups with:
|
2021-11-07 20:59:18 +03:00
|
|
|
|
|
2023-09-14 20:09:18 +03:00
|
|
|
|
```
|
|
|
|
|
CI=1 INSIDERS=1 mkdocs build
|
|
|
|
|
```
|
2022-04-06 21:45:44 +03:00
|
|
|
|
|
2023-09-14 20:09:18 +03:00
|
|
|
|
[^1]:
|
|
|
|
|
Previously we recommended to use [configuration inheritance] to work around
|
|
|
|
|
this limitations, but the brand new [built-in group plugin] is a much better
|
|
|
|
|
approach, as it allows you to use a single configuration file for building
|
|
|
|
|
your project with the community edition and Insiders version of Material
|
|
|
|
|
for MkDocs.
|
2022-04-06 21:45:44 +03:00
|
|
|
|
|
2023-09-14 20:09:18 +03:00
|
|
|
|
[built-in group plugin]: ../plugins/group.md
|
|
|
|
|
[configuration inheritance]: https://www.mkdocs.org/user-guide/configuration/#configuration-inheritance
|