diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 000000000..aa357f2f5 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,11 @@ +{ + "name": "Material for MkDocs - VS Code dev container", + "image": "mcr.microsoft.com/devcontainers/typescript-node:0-18", + "features": { + "ghcr.io/devcontainers/features/python:1": { + "installTools": true, + "version": "3.11" + } + }, + "postCreateCommand": "pip install -e . && pip install mkdocs-minify-plugin mkdocs-redirects && npm install && npm run build" +} diff --git a/.dockerignore b/.dockerignore index ee5a90b3c..8f85b3e0c 100644 --- a/.dockerignore +++ b/.dockerignore @@ -22,6 +22,6 @@ .git .github docs -material/.overrides +material/overrides node_modules src diff --git a/.editorconfig b/.editorconfig index eaff74302..4ae0589a6 100644 --- a/.editorconfig +++ b/.editorconfig @@ -30,10 +30,6 @@ end_of_line = lf insert_final_newline = true trim_trailing_whitespace = true -# Markdown -[*.md] -trim_trailing_whitespace = false - # Python [*.py] indent_style = space diff --git a/.eslintrc b/.eslintrc index 5c202c084..527cded01 100644 --- a/.eslintrc +++ b/.eslintrc @@ -320,7 +320,6 @@ } ], "jsdoc/empty-tags": "warn", - "jsdoc/newline-after-description": "warn", "jsdoc/no-bad-blocks": "warn", "jsdoc/no-defaults": "warn", "jsdoc/no-types": "warn", diff --git a/.github/ISSUE_TEMPLATE/01-report-a-bug.yml b/.github/ISSUE_TEMPLATE/01-report-a-bug.yml index 6cd2bee3e..f9d126129 100644 --- a/.github/ISSUE_TEMPLATE/01-report-a-bug.yml +++ b/.github/ISSUE_TEMPLATE/01-report-a-bug.yml @@ -31,7 +31,7 @@ body: description: >- Please list all links to the sections of [our documentation](https://squidfunk.github.io/mkdocs-material) that - are relevant to the bug, in order to show that you have consulted and + are relevant to the bug in order to show that you have consulted and thoroughly read it. Additionally, list links to possibly related open and closed [issues](https://github.com/squidfunk/mkdocs-material/issues) and [discussions](https://github.com/squidfunk/mkdocs-material/discussions) @@ -54,7 +54,7 @@ body: .zip file with the reproduction. We reserve the right to close issues without .zip files. [More](https://squidfunk.github.io/mkdocs-material/contributing/reporting-a-bug/#reproduction) placeholder: |- - Drag and drop .zip file with minimal reproduction here. + Drag and drop the .zip file with minimal reproduction here. validations: required: true diff --git a/.github/ISSUE_TEMPLATE/02-report-a-docs-issue.yml b/.github/ISSUE_TEMPLATE/02-report-a-docs-issue.yml index 648d5bb98..c62ef41bb 100644 --- a/.github/ISSUE_TEMPLATE/02-report-a-docs-issue.yml +++ b/.github/ISSUE_TEMPLATE/02-report-a-docs-issue.yml @@ -12,7 +12,7 @@ body: Please describe the inconsistency or issue you have found in [our documentation](https://squidfunk.github.io/mkdocs-material) or indicate where you feel there is a need for improvement. Furthermore, - explain the severity of the issue, i.e., it's impact on you and potentially + explain the severity of the issue, i.e., its impact on you and potentially other users. [More](https://squidfunk.github.io/mkdocs-material/contributing/reporting-a-docs-issue/#description) validations: diff --git a/.github/ISSUE_TEMPLATE/03-request-a-change.yml b/.github/ISSUE_TEMPLATE/03-request-a-change.yml index 3fa6a0322..39bffb9a3 100644 --- a/.github/ISSUE_TEMPLATE/03-request-a-change.yml +++ b/.github/ISSUE_TEMPLATE/03-request-a-change.yml @@ -17,8 +17,8 @@ body: attributes: label: Description description: >- - Please provide a detailed description of your idea in 2-3 sentences, so - that we maintainers can fully understand what change, feature, or + Please provide a detailed description of your idea in 2-3 sentences so + that we maintainers can fully understand what change, feature, or the improvement you are proposing. Don't yet explain the benefits of your idea, we'll come to that. Focus on functionality. [More](https://squidfunk.github.io/mkdocs-material/contributing/requesting-a-change/#description) @@ -31,7 +31,7 @@ body: label: Related links description: >- Please list all links to open and closed [issues](https://github.com/squidfunk/mkdocs-material/issues), - [discussions](https://github.com/squidfunk/mkdocs-material/discussions) + [discussions](https://github.com/squidfunk/mkdocs-material/discussions), or to [documentation sections](https://squidfunk.github.io/mkdocs-material) that are relevant to your idea. If you discussed your idea with the community on our @@ -50,8 +50,8 @@ body: label: Use Cases description: >- Please explain how your idea will work from an author's and user's - perspective. Elaborate how the change would positively impact not only - you, but the community, and how it aligns with the goals and [philopsophy](https://squidfunk.github.io/mkdocs-material/philosophy/) + perspective. Elaborate on how the change would positively impact not only + you but our community and how it aligns with the goals and [philosophy](https://squidfunk.github.io/mkdocs-material/philosophy/) of the project. [More](https://squidfunk.github.io/mkdocs-material/contributing/requesting-a-change/#use-cases) validations: @@ -87,9 +87,9 @@ body: I have verified that [my idea is a change request and not a bug report](https://squidfunk.github.io/mkdocs-material/contributing/requesting-a-change/#its-not-a-bug-its-a-feature). required: true - label: >- - I have ensured that, to the best knowledge, [my idea will benefit the entire community](https://squidfunk.github.io/mkdocs-material/contributing/requesting-a-change/#benefit-for-the-community). + I have ensured that, to the best of my knowledge, [my idea will benefit the entire community](https://squidfunk.github.io/mkdocs-material/contributing/requesting-a-change/#benefit-for-the-community). required: true - label: >- - I have included relevant links to [the documentation](https://squidfunk.github.io/mkdocs-material), related [issues](https://github.com/squidfunk/mkdocs-material/issues) + I have included relevant links to [the documentation](https://squidfunk.github.io/mkdocs-material), related [issues](https://github.com/squidfunk/mkdocs-material/issues), and [discussions](https://github.com/squidfunk/mkdocs-material/discussions) to underline the need for my idea. required: true diff --git a/.github/ISSUE_TEMPLATE/04-add-a-translation.yml b/.github/ISSUE_TEMPLATE/04-add-translations.yml similarity index 86% rename from .github/ISSUE_TEMPLATE/04-add-a-translation.yml rename to .github/ISSUE_TEMPLATE/04-add-translations.yml index e7322b93c..d23b6fcd5 100644 --- a/.github/ISSUE_TEMPLATE/04-add-a-translation.yml +++ b/.github/ISSUE_TEMPLATE/04-add-translations.yml @@ -30,6 +30,14 @@ body: "action.skip": "Skip to content", "action.view": "View source of this page", "announce.dismiss": "Don't show this again", + "blog.archive": "Archive", + "blog.categories": "Categories", + "blog.categories.in": "in", + "blog.continue": "Continue reading", + "blog.draft": "Draft", + "blog.index": "Back to index", + "blog.meta": "Metadata", + "blog.references": "Related links", "clipboard.copy": "Copy to clipboard", "clipboard.copied": "Copied to clipboard", "consent.accept": "Accept", @@ -42,6 +50,10 @@ body: "meta.comments": "Comments", "meta.source": "Source", "nav": "Navigation", + "readtime.one": "1 min read", + "readtime.other": "# min read", + "rss.created": "RSS feed", + "rss.updated": "RSS feed of updated content", "search": "Search", "search.placeholder": "Search", "search.share": "Share", @@ -57,6 +69,7 @@ body: "select.language": "Select language", "select.version": "Select version", "source": "Go to repository", + "source.file.contributors": "Contributors", "source.file.date.created": "Created", "source.file.date.updated": "Last update", "tabs": "Tabs", @@ -89,7 +102,7 @@ body: options: - label: I've checked the list of [available languages](https://squidfunk.github.io/mkdocs-material/setup/changing-the-language/#site-language) for existing translations. required: true - - label: I have assured that, to the best of my knowledge, the translations are accurate. + - label: I assure that the translations are accurate to the best of my knowledge. required: true - label: >- __Optional__: I want to integrate this translation myself and create a diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 43c226a6e..20efdf3c6 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -22,4 +22,6 @@ blank_issues_enabled: false contact_links: - name: Ask a question url: https://github.com/squidfunk/mkdocs-material/discussions - about: Have a question or need help? Connect with the community on our discussion board + about: > + Have a question or need help? Connect with our community on the + discussion board diff --git a/.github/assets/sponsors/sponsor-astral.png b/.github/assets/sponsors/sponsor-astral.png new file mode 100644 index 000000000..dda0e6066 Binary files /dev/null and b/.github/assets/sponsors/sponsor-astral.png differ diff --git a/.github/assets/sponsors/sponsor-automation-technology.png b/.github/assets/sponsors/sponsor-automation-technology.png deleted file mode 100644 index 7f9547641..000000000 Binary files a/.github/assets/sponsors/sponsor-automation-technology.png and /dev/null differ diff --git a/.github/assets/sponsors/sponsor-botcity.png b/.github/assets/sponsors/sponsor-botcity.png new file mode 100644 index 000000000..bf229458e Binary files /dev/null and b/.github/assets/sponsors/sponsor-botcity.png differ diff --git a/.github/assets/sponsors/sponsor-buhler.png b/.github/assets/sponsors/sponsor-buhler.png new file mode 100644 index 000000000..d58a2c5df Binary files /dev/null and b/.github/assets/sponsors/sponsor-buhler.png differ diff --git a/.github/assets/sponsors/sponsor-evergiving.png b/.github/assets/sponsors/sponsor-evergiving.png new file mode 100644 index 000000000..31950c77d Binary files /dev/null and b/.github/assets/sponsors/sponsor-evergiving.png differ diff --git a/.github/assets/sponsors/sponsor-getscreenme.png b/.github/assets/sponsors/sponsor-getscreenme.png new file mode 100644 index 000000000..fc3c974cc Binary files /dev/null and b/.github/assets/sponsors/sponsor-getscreenme.png differ diff --git a/.github/assets/sponsors/sponsor-hyperledger.png b/.github/assets/sponsors/sponsor-hyperledger.png deleted file mode 100644 index 460ee0880..000000000 Binary files a/.github/assets/sponsors/sponsor-hyperledger.png and /dev/null differ diff --git a/.github/assets/sponsors/sponsor-ip-fabric.png b/.github/assets/sponsors/sponsor-ip-fabric.png index 839944e22..c86ec4665 100644 Binary files a/.github/assets/sponsors/sponsor-ip-fabric.png and b/.github/assets/sponsors/sponsor-ip-fabric.png differ diff --git a/.github/assets/sponsors/sponsor-kolena.png b/.github/assets/sponsors/sponsor-kolena.png new file mode 100644 index 000000000..a0a65d38b Binary files /dev/null and b/.github/assets/sponsors/sponsor-kolena.png differ diff --git a/.github/assets/sponsors/sponsor-koor.png b/.github/assets/sponsors/sponsor-koor.png new file mode 100644 index 000000000..dfa2c5fce Binary files /dev/null and b/.github/assets/sponsors/sponsor-koor.png differ diff --git a/.github/assets/sponsors/sponsor-oikolab.png b/.github/assets/sponsors/sponsor-oikolab.png new file mode 100644 index 000000000..8fd593fd5 Binary files /dev/null and b/.github/assets/sponsors/sponsor-oikolab.png differ diff --git a/.github/assets/sponsors/sponsor-sn-technology.png b/.github/assets/sponsors/sponsor-sn-technology.png new file mode 100644 index 000000000..9d72964d1 Binary files /dev/null and b/.github/assets/sponsors/sponsor-sn-technology.png differ diff --git a/.github/assets/sponsors/sponsor-transformationflow.png b/.github/assets/sponsors/sponsor-transformationflow.png new file mode 100644 index 000000000..8d59a5992 Binary files /dev/null and b/.github/assets/sponsors/sponsor-transformationflow.png differ diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 3df61b35c..23de615b2 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -28,7 +28,9 @@ updates: interval: weekly time: "04:00" - package-ecosystem: pip - open-pull-requests-limit: 10 + # We only want to bump versions of packages in case of security updates, as + # we want to keep maximum compatibility - see https://t.ly/INSR_ + open-pull-requests-limit: 0 directory: "/" labels: [] schedule: diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fd28646aa..3dabde071 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,7 +29,7 @@ on: - published env: - NODE_VERSION: 14.x + NODE_VERSION: 18.x PYTHON_VERSION: 3.x permissions: @@ -41,7 +41,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Node.js runtime uses: actions/setup-node@v3 @@ -72,7 +72,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Python runtime uses: actions/setup-python@v4 @@ -97,24 +97,24 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Login to DockerHub if: github.event_name == 'release' - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - name: Login to GitHub Container Registry if: github.event_name == 'release' - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.repository_owner }} @@ -122,20 +122,22 @@ jobs: - name: Generate Docker tags and labels id: meta - uses: docker/metadata-action@v4 + uses: docker/metadata-action@v5 with: images: | ${{ github.event.repository.full_name }} ghcr.io/${{ github.event.repository.full_name }} tags: | + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} type=ref,event=branch - type=ref,event=tag type=ref,event=pr flavor: | latest=${{ github.event.release.prerelease == false }} - name: Build Docker image - uses: docker/build-push-action@v4 + uses: docker/build-push-action@v5 with: context: . load: true @@ -144,9 +146,11 @@ jobs: - name: Check Docker image working-directory: /tmp + env: + REPO_FULL_NAME: '${{ github.event.repository.full_name }}' run: | - docker run --rm -i -v ${PWD}:/docs ${{ github.event.repository.full_name }}:${{ steps.meta.outputs.version }} new . - docker run --rm -i -v ${PWD}:/docs ${{ github.event.repository.full_name }}:${{ steps.meta.outputs.version }} build + docker run --rm -i -v ${PWD}:/docs ${REPO_FULL_NAME,,}:${{ steps.meta.outputs.version }} new . + docker run --rm -i -v ${PWD}:/docs ${REPO_FULL_NAME,,}:${{ steps.meta.outputs.version }} build - name: Set platforms if: github.event_name == 'release' @@ -154,7 +158,7 @@ jobs: echo "PLATFORMS=linux/amd64,linux/arm64,linux/arm/v7" >> $GITHUB_ENV - name: Publish Docker image - uses: docker/build-push-action@v4 + uses: docker/build-push-action@v5 with: context: . platforms: ${{ env.PLATFORMS }} diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 4be118233..8fca7b29f 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -37,7 +37,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 @@ -46,12 +46,17 @@ jobs: with: python-version: ${{ env.PYTHON_VERSION }} + - name: Set the date environmental variable + run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV + - name: Set up build cache uses: actions/cache@v3 id: cache with: - key: ${{ runner.os }}-${{ hashFiles('.cache/**') }} + key: mkdocs-material-${{ env.cache_id }} path: .cache + restore-keys: | + mkdocs-material- - name: Install dependencies run: sudo apt-get install pngquant @@ -65,6 +70,7 @@ jobs: "mkdocs-minify-plugin>=0.3" \ "mkdocs-rss-plugin>=1.2" \ "mkdocs-redirects>=1.0" \ + "lxml" \ "pillow<10" - name: Install Insiders build diff --git a/.gitignore b/.gitignore index a5569039b..4e015a043 100644 --- a/.gitignore +++ b/.gitignore @@ -55,10 +55,6 @@ example.zip # Never ignore .gitkeep files !**/.gitkeep -# Husky hooks -.husky/.gitignore -.husky/_ - # macOS internals .DS_Store diff --git a/.stylelintrc b/.stylelintrc index bf6ebd050..50538eb0c 100644 --- a/.stylelintrc +++ b/.stylelintrc @@ -73,6 +73,8 @@ ], "linebreaks": "unix", "media-feature-name-no-unknown": null, + "media-feature-range-notation": null, + "media-query-no-invalid": null, "no-descending-specificity": null, "no-empty-first-line": true, "no-unknown-animations": true, diff --git a/.vscode/settings.json b/.vscode/settings.json index 7e278e9a6..36ef96f40 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -17,8 +17,5 @@ "tag:yaml.org,2002:python/name:materialx.emoji.to_svg", "tag:yaml.org,2002:python/name:materialx.emoji.twemoji", "tag:yaml.org,2002:python/name:pymdownx.superfences.fence_code_format" - ], - "cSpell.words": [ - "mkdocs" ] } diff --git a/CHANGELOG b/CHANGELOG index 41f5753e5..0ca98300b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,373 @@ +mkdocs-material-9.3.2+insiders-4.42.0 (2023-09-19) + + * Added support for using git submodules in projects plugin + * Added support for transforming project configurations + * Improved resilience of optimize and blog plugin + * Fixed optimize plugin crashing on .jpeg extension + * Fixed project URLs not using site URLs in projects plugin + +mkdocs-material-9.3.2 (2023-09-19) + + * Updated Slovenian translations + * Updated Python dependencies in requirements to use minimum versions + * Fixed #6017: Code highlighting inconsistent in Community and Insiders edition + * Fixed #6001: Contributor avatars display incorrectly in Firefox + * Fixed #6000: Blog post drafts are included in navigation + +mkdocs-material-9.3.1+insiders-4.41.0 (2023-09-11) + + * Improved multi-instance support for optimize plugin + * Added inclusion and exclusion patterns for optimize plugin + * Added transparent keyword for color handling in social plugin + * Changed default quality of PNGs to 3 in optimize plugin + * Fixed #5979: meta file not detected in root of docs directory + +mkdocs-material-9.3.1 (2023-09-11) + + * Fixed crash of group plugin when used together with hooks + +mkdocs-material-9.3.0 (2023-09-11) + + * Improved configuration sharing between Community and Insiders edition + * Added experimental built-in group plugin for enabling plugins conditionally + * Added new settings in tags plugin for enabling/disabling + * Dropped support for Python 3.7 (EOL) + +mkdocs-material-9.2.8+insiders-4.40.4 (2023-09-04) + + * Fixed privacy plugin choking on boolean HTML5 attributes + * Fixed wrapping of inline code blocks in typeset table of contents + * Fixed blog plugin error when running under dirty reload + +mkdocs-material-9.2.8 (2023-09-04) + + * Updated Italian and Russian translations + * Fixed #5952: Combining blog and tags plugin leads to wrong links + * Fixed #5951: Blog plugin ignores post title in metadata + * Fixed #5949: Blog plugin ignores post linked in nav + +mkdocs-material-9-2.7+insiders-4.40.3 (2023-09-02) + + * Fixed #5946: Docker image missing pngquant for optimize plugin + +mkdocs-material-9.2.7 (2023-09-02) + + * Switched dependencies to compatible release clauses + * Removed readtime and lxml dependencies for blog plugin + * Reduced size of Docker image to improve CI build performance + * Fixed #5945: Incorrect footer navigation for sibling pages of blog + * Fixed #5939: Page jumps when changing color palette (Firefox 117) + * Fixed #5901: Announcement bar reappears when using instant loading + * Fixed #5824: Allow to customize styles of sequence diagrams + +mkdocs-material-9-2.6+insiders-4.40.2 (2023-08-31) + + * Added configurable error handling capabilities for social plugin + * Fixed #5922: Blog plugin shows no posts when building a standalone blog + * Fixed #5914: Tags plugin tags_extra_files errors (4.39.3 regression) + * Fixed #5904: Blog plugin sometimes excludes files (4.40.1 regression) + +mkdocs-material-9-2.6 (2023-08-31) + + * Added Basque translations + * Added template for simple redirects + * Improved blog plugin interop by moving view generation to on_files + * Fixed #5924: Social plugin still checks dependencies when disabled + * Fixed #5916: Blog plugin crashes on Python 3.8 (9.2.0 regression) + +mkdocs-material-9-2.5+insiders-4.40.1 (2023-08-27) + + * Fixed #5902: ResizeObserver polyfill not detected by privacy plugin + * Fixed empty category pages in blog plugin (4.40.0 regression) + +mkdocs-material-9-2.5 (2023-08-27) + + * Fixed error in dirty serve mode when using blog plugin + * Fixed page title not being consistent in blog plugin pagination + * Fixed #5899: Blog plugin pagination breaks when disabling directory URLs + +mkdocs-material-9.2.4+insiders-4.40.0 (2023-08-26) + + * Added logo, title and description options to social plugin default layouts + * Fixed privacy plugin compatibility issue with Python < 3.10 + * Fixed #5896: Blog plugin errors when using custom index pages + +mkdocs-material-9.2.4 (2023-08-26) + + * Added version to bug report name in info plugin + * Updated Afrikaans translations + +mkdocs-material-9.2.3+insiders-4.39.3 (2023-08-24) + + * Fixed lxml dependency missing in Docker image (4.39.2 regression) + +mkdocs-material-9.2.3+insiders-4.39.2 (2023-08-23) + + * Fixed color palette toggle being reversed (9.2.0 regression) + +mkdocs-material-9.2.3 (2023-08-22) + + * Fixed blog plugin rendering wrongly with markdown.extensions.toc + * Fixed blog plugin entrypoint generation + +mkdocs-material-9.2.2 (2023-08-22) + + * Fixed #5880: Blog plugin failing when building a standalone blog + * Fixed #5881: Blog plugin not compatible with Python < 3.10 + +mkdocs-material-9.2.1 (2023-08-21) + + * Fixed #5879: Blog plugin failing when building a standalone blog + * Fixed error in blog plugin when using draft tagging on future date + * Fixed error in blog plugin when toc extension is not enabled + +mkdocs-material-9.2.0+insiders-4.39.1 (2023-08-21) + + * Fixed git diff in tags plugin after merging back 9.2.0 changes + +mkdocs-material-9.2.0 (2023-08-21) + + Additions and improvements + + * Added blogging support via built-in blog plugin + * Added support for Chinese language segmentaiton in search plugin + * Added support for adding custom dates to blog posts + * Added support for paginating archive and category pages + * Added support for annotations (outside of code blocks) + * Added support for navigation icons + * Added support for navigation pruning + * Added support for navigation status + * Added support for customizing site icons + * Added support for customizing (code) annotation icons + * Added focus outline to admonitions and details + * Added prompt for bug report name to info plugin + * Added Luxembourgish translations + * Improved rendering of (code) annotation markers + * Improved print styles for (code) annotations + * Improved customizability of navigation tabs + * Improved interop of plugins with external tools like mike + * Improved interop of blog plugin with awesome pages plugin + * Improved header partial by moving buttons into separate partials + * Improved clarity of site_url warning in social plugin + * Improved blog plugin to automatically setup directory structure + * Switched info plugin to importlib to mitigate deprecations + * Automatically download ResizeObserver polyfill when necessary + * Automatically add iframe-worker polyfill when necessary in offline plugin + * Automatically focus and bring up keyboard on touch devices + * Updated Serbo-Croatian translations + * Updated MkDocs to 1.5.2 + + Removals + + * Removed Universal Analytics integration + * Removed ancient polyfills to reduce size of bundled JavaScript by 20% + * Removed necessity for Array.flat and Array.flatMap polyfill + * Removed announcement bar button when JavaScript is not available + + Fixes + + * Fixed rendering of tags when announcement bar is present + * Fixed tags plugin rendering pages excluded by other plugins + * Fixed #5132: Blog plugin requires nav entry in mkdocs.yml + * Fixed #5599: Insufficient contrast for default link color + * Fixed #5715: Blog plugin missing integrated table of contents in pagination + * Fixed #5806: Version selector not hoverable on some Android devices + * Fixed #5826: Blog post drafts with tags show up in tags index + +mkdocs-material-9.1.21+insiders-4.39.0 (2023-08-01) + + * Added support for hoisting theme media files when building projects + * Added support for sorting pages on tags index for tags plugin + * Added support for adding date of last update to blog posts + * Fixed #5797: Parse error in typeset plugin (4.38.1 regression) + +mkdocs-material-9.1.21+insiders-4.38.1 (2023-08-01) + + * Improved nested serve mode for projects plugin + * Improved compat in privacy plugin with third-party plugins + * Fixed #5790: Typeset plugin ignores data-toc-label attribute + * Fixed #5778: Interplay of privacy plugin with git-revision-date-localized + * Fixed #5773: Info plugin erroring when community edition is in beta + +mkdocs-material-9.1.21+insiders-4.38.0 (2023-07-29) + + * Added projects plugin for building nested projects + * Updated privacy plugin to new MkDocs API + +mkdocs-material-9.1.21+insiders-4.37.1 (2023-07-28) + + * Updated MkDocs to 1.5.1 + * Fixed deprecation warning in social plugin due to MkDocs upgrade + * Fixed #5772: Privacy plugin fails due to API change in MkDocs + +mkdocs-material-9.1.21 (2023-07-27) + + * Fixed MkDocs 1.4 compat issue in social plugin (9.1.20 regression) + +mkdocs-material-9.1.20 (2023-07-27) + + * Fixed deprecation warnings for social plugin + +mkdocs-material-9.1.19 (2023-07-18) + + * Added support for MkDocs 1.5+ + * Fixed #5699: Improve error reporting in social plugin + +mkdocs-material-9.1.18+insiders-4.37.0 (2023-07-07) + + * Added support for overriding social cards settings per page + * Added new social card default/only/image layout + * Improved resilience of optimize and social plugin + * Fixed rendering bugs for pruned navigation items + * Fixed jumping of content tabs anchor links when instant loading is enabled + * Fixed #5676: Optimize plugin doesn't check for pngquant + +mkdocs-material-9.1.18 (2023-07-03) + + * Updated Danish translations + * Added support for installing user requirements in Docker image + * Fixed #5655: Search separator with lookbehind breaks highlighting + +mkdocs-material-9.1.17+insiders-4.36.1 (2023-06-23) + + * Fixed #5618: Date comparison breaking for drafts in blog plugin + +mkdocs-material-9.1.17 (2023-06-23) + + * Fixed #5633: Code annotations with nested lists incorrectly mounted + * Fixed #5628: Regression in new social plugin configuration scheme + +mkdocs-material-9.1.16+insiders-4.36.0 (2023-06-15) + + * Added support for instant prefetching to speed up slow connections + * Improved stability of anchor link removal in built-in typeset plugin + * Improved performance of regular expressions in typeset plugin + * Removed unnecessary import test for cairosvg in optimize plugin + * Fixed #5590: regular expression for anchor link removal too greedy + +mkdocs-material-9.1.16 (2023-06-15) + + * Updated Indonesian translations + * Ensure scroll bar follows color scheme of operating system + +mkdocs-material-9.1.15+insiders-4.35.3 (2023-06-01) + + * Fixed #5579: Abbreviations in headlines filtered by typeset plugin + +mkdocs-material-9.1.15+insiders-4.35.2 (2023-05-29) + + * Fixed #5555: Blog plugin crashes when computing readtime for emojis + +mkdocs-material-9.1.15 (2023-05-29) + + * Fixed #5566: Indicate color scheme to operating system + * Fixed #5565: Update Dockerfile to latest version of base image + * Fixed #5554: Add additional version tags (9, 9.1) to Docker image + * Fixed #5536: Strip tags of ARIA labels in table of contents + +mkdocs-material-9.1.14+insiders-4.35.1 (2023-05-20) + + * Fixed internal handling of errors in social plugin + +mkdocs-material-9.1.14+insiders-4.35.0 (2023-05-20) + + * Improve editing experience and stability of social plugin + * Added support for custom layout syntax validation in social plugin + * Added support for layer origin for easier placement in social plugin + * Added support for in- and exclusion patterns in social plugin + * Catch and print syntax errors in custom layouts + +mkdocs-material-9.1.14 (2023-05-20) + + * Updated Armenian and Greek translations + +mkdocs-material-9.1.13+insiders-4.34.1 (2023-05-16) + + * Disable social plugin debug mode by default on mkdocs build + * Added warning in social plugin debug mode when font style couldn't be found + * Set default concurrency of built-in multi-threaded plugins to CPUs - 1 + * Fixed #5521: Social plugin triggers race condition when downloading fonts + * Fixed #5515: Social plugin crashes when concurrency is set to 1 + +mkdocs-material-9.1.13 (2023-05-16) + + * Fixed #5517: Social plugin crashes for some fonts (e.g. Open Sans) + +mkdocs-material-9.1.12+insiders-4.34.0 (2023-05-14) + + * Added support for new overflow mode to auto-fit text in social plugin + * Reduced subtle rendering bugs in (code) annotations due to subpixel rounding + * Improved print styles for (code) annotation lists + * Improved performance of social plugin, now 3x as fast + * Improved interop of typeset plugin with MkDocstrings + * Fixed logo location for variants of default template in social plugin + * Fixed #5446: Built-in typeset plugin picks up headings in code blocks + +mkdocs-material-9.1.12+insiders-4.33.2 (2023-05-12) + + * Fixed #5508: Social plugin crashes trying to copy cards on Docker/Windows + * Fixed #5507: Social plugin crashes on serve when layouts folder doesn't exist + * Fixed #5505: Social plugin trying to resolve logo in wrong location + * Fixed #5496: Annotations with nested lists incorrectly mounted + * Fixed #5493: Social plugin crashes on Python 3.8 + +mkdocs-material-9.1.12 (2023-05-12) + + * Updated Bengali (Bangla) translations + * Fixed #5503: Docker image publish errors on uppercase characters + * Fixed #5407: Auto-pause media when in hidden content tabs + +mkdocs-material-9.1.11+insiders-4.33.1 (2023-05-09) + + * Added support for SVG background images in social plugin + +mkdocs-material-9.1.11 (2023-05-08) + + * Fixed #5487: Social plugin crashes without options (9.1.10 regression) + +mkdocs-material-9.1.10+insiders-4.33.0 (2023-05-08) + + * Added support for custom layouts for social plugin + * Added support for background images for social cards + +mkdocs-material-9.1.10 (2023-05-08) + + * Added cards_layout_options setting for social cards + * Deprecated cards_color and cards_font setting for social cards + +mkdocs-material-9.1.9 (2023-05-02) + + * Added Telugu, Kannada and Sanskrit translations + * Fixed #5428: Fixed margins for light/dark mode images in figures + * Fixed #5420: Social plugin crashing for some specific Google Fonts + * Fixed #5160: Instant loading makes code annotations jump (9.1.1 regression) + * Fixed #4920: Social plugin not loading logo from custom icon set + * Fixed social plugin crashing when only code font is specified + +mkdocs-material-9.1.8 (2023-04-24) + + * Fixed #5417: Theme breaks when palette is not defined (9.1.7 regression) + +mkdocs-material-9.1.7+insiders-4.32.6 (2023-04-22) + + * Fixed #5336: Interplay of blog plugin with git-revision-date-localized + +mkdocs-material-9.1.7 (2023-04-22) + + * Updated Persian (Farsi) and Turkish translations + * Fixed #5401: Added missing flag to disable built-in tags plugin + * Fixed #5206: Ensure defaults are set for primary and accent colors + * Fixed unnecessary inclusion of palette CSS when unused + +mkdocs-material-9.1.6+insiders-4.32.5 (2023-04-07) + + * Fixed #5322: Navigation tabs hoist nested page icons + +mkdocs-material-9.1.6 (2023-04-07) + + * Updated Persian (Farsi) translations + * Fixed #5300: Boxes in Mermaid sequence diagrams not color-abiding + mkdocs-material-9.1.5 (2023-03-31) * Updated Lithuanian and Japanese translations @@ -143,7 +513,7 @@ mkdocs-material-9.0.8 (2023-01-29) mkdocs-material-9.0.7 (2023-01-28) * Improved accessibility of sidebar navigation - * Moved all translations into community edition + * Moved all translations into Community edition * Updated Polish and Portuguese (Brasilian) translations * Fixed info plugin terminating on subsequent reload when serving * Fixed #4910: Sidebar navigation labels have invalid ARIA roles diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 4054c0598..c0ab1ca27 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -5,7 +5,7 @@ In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body -size, disability, ethnicity, gender identity and expression, level of experience, +size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. @@ -16,7 +16,7 @@ Examples of behavior that contributes to creating a positive environment include * Using welcoming and inclusive language * Being respectful of differing viewpoints and experiences * Gracefully accepting constructive criticism -* Focusing on what is best for the community +* Focusing on what is best for our community * Showing empathy towards other community members Examples of unacceptable behavior by participants include: @@ -36,7 +36,7 @@ Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. -Project maintainers have the right and responsibility to remove, edit, or reject +Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, @@ -45,21 +45,21 @@ offensive, or harmful. ## Scope This Code of Conduct applies both within project spaces and in public spaces -when an individual is representing the project or its community. Examples of +when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail -address, posting via an official social media account, or acting as an appointed -representative at an online or offline event. Representation of a project may be +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported by contacting the project team at -https://gitter.im/squidfunk/mkdocs-material. The project team will review and -investigate all complaints, and will respond in a way that it deems appropriate -to the circumstances. The project team is obligated to maintain confidentiality -with regard to the reporter of an incident. Further details of specific -enforcement policies may be posted separately. +reported by contacting the project team privately at hello@squidfunk.com. The +project team will review and investigate all complaints, and will respond in a +way that it deems appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an +incident. Further details of specific enforcement policies may be posted +separately. Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index dbf07b96e..4100fccc7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,59 +1,61 @@ # Contributing -Material for MkDocs is an actively maintained and constantly improved project -that serves a diverse user base with varying backgrounds and needs. In order to -effectively address the needs of all our users, evaluatgit e requests, and fix bugs, -we maintainers need to put in a lot of work. We have devoted significant effort -to creating better templates for our issue tracker, optimizing the processes for -our users to report bugs, request features or changes, contribute to the -project, or exchange with our community. +Material for MkDocs is an actively maintained and constantly improved project +that serves a diverse user base with varying backgrounds and needs. In order to +effectively address the needs of all our users, evaluate change requests, and +fix bugs, we maintainers need to put in a lot of work. We have devoted +significant effort to creating better templates for our issue tracker, +optimizing the processes for our users to report bugs, request features or +changes, contribute to the project, or exchange with our community. -Given the wealth of valuable knowledge contained in numerous issues and -discussions, we consider our [issue tracker] and [discussion board] to serve as a -crucial __knowledge base__ that is an important addition to our [documentation] +Given the wealth of valuable knowledge contained in numerous issues and +discussions, we consider our [issue tracker] and [discussion board] to serve as +a crucial __knowledge base__ that is an important addition to our [documentation] and brings value to both new and experienced users of Material for MkDocs. -## How to contribute - -Selecting the appropriate contribution template is essential to maintain the -organization, searchability, and ease of use of this knowledge base. In this -section of our documentation, we outline the available options and their -respective procedures. - [discussion board]: https://github.com/squidfunk/mkdocs-material/discussions [issue tracker]: https://github.com/squidfunk/mkdocs-material/issues [documentation]: https://squidfunk.github.io/mkdocs-material/ - + +## How to contribute ### Creating an issue -- #### [Report a bug][report a bug] +- #### [Report a bug] - __Something is not working?__ Report a bug in Material for MkDocs by creating an issue with a reproduction + __Something is not working?__ Report a bug in Material for MkDocs by + creating an issue with a reproduction -- #### [Report a docs issue][report a docs issue] +- #### [Report a docs issue] - __Missing information in our docs?__ Report missing information or potential inconsistencies in our documentation + __Missing information in our docs?__ Report missing information or + potential inconsistencies in our documentation -- #### [Request a change][request a change] +- #### [Request a change] - __Want to submit an idea?__ Propose a change or feature request or suggest an improvement + __Want to submit an idea?__ Propose a change, feature request, or + suggest an improvement -- #### [Ask a question][ask a question] +- #### [Ask a question] - __Have a question or need help?__ Ask a question on our discussion board and get in touch with our community + __Have a question or need help?__ Ask a question on our [discussion board] + and get in touch with our community -### Contributing to this project +### Contributing -- #### [Add a translation](https://github.com/squidfunk/mkdocs-material/adding-a-translation) - - __Missing support for your language?__ Add missing translations for a new or supported language +- #### [Add a translation] -- #### [Create a pull request](https://github.com/squidfunk/mkdocs-material/creating-a-pull-request) - - __Want to create a pull request?__ Learn how to create a comprehensive pull request (PR) + __Missing support for your language?__ Add missing translations for a new + or already supported language - [report a bug]: reporting-a-bug.md - [report a docs issue]: reporting-a-docs-issue.md - [request a change]: requesting-a-change.md - [ask a question]: https://github.com/squidfunk/mkdocs-material/discussions +- #### [Create a pull request] + + __Want to create a pull request?__ Learn how to create a comprehensive + and useful pull request (PR)s + + [Report a bug]: reporting-a-bug.md + [Report a docs issue]: reporting-a-docs-issue.md + [Request a change]: requesting-a-change.md + [Ask a question]: https://github.com/squidfunk/mkdocs-material/discussions + [Add a translation]: https://github.com/squidfunk/mkdocs-material/adding-a-translation + [Create a pull request]: https://github.com/squidfunk/mkdocs-material/pulls diff --git a/Dockerfile b/Dockerfile index 65932963f..65ff5acf5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,7 +18,7 @@ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. -FROM python:3.11.0-alpine3.17 +FROM python:3.11-alpine3.18 # Build-time flags ARG WITH_PLUGINS=true @@ -34,7 +34,7 @@ WORKDIR /tmp COPY material material COPY package.json package.json COPY README.md README.md -COPY requirements.txt requirements.txt +COPY *requirements.txt ./ COPY pyproject.toml pyproject.toml # Perform build and cleanup artifacts and caches @@ -54,15 +54,19 @@ RUN \ gcc \ libffi-dev \ musl-dev \ +&& \ + pip install --no-cache-dir --upgrade pip \ && \ pip install --no-cache-dir . \ && \ if [ "${WITH_PLUGINS}" = "true" ]; then \ pip install --no-cache-dir \ - "mkdocs-minify-plugin>=0.3" \ - "mkdocs-redirects>=1.0" \ - "pillow>=9.0" \ - "cairosvg>=2.5"; \ + mkdocs-material[recommended] \ + mkdocs-material[imaging]; \ + fi \ +&& \ + if [ -e user-requirements.txt ]; then \ + pip install -U -r user-requirements.txt; \ fi \ && \ apk del .build \ @@ -70,7 +74,7 @@ RUN \ for theme in mkdocs readthedocs; do \ rm -rf ${PACKAGES}/mkdocs/themes/$theme; \ ln -s \ - ${PACKAGES}/material \ + ${PACKAGES}/material/templates \ ${PACKAGES}/mkdocs/themes/$theme; \ done \ && \ diff --git a/README.md b/README.md index 6e23b3941..6d44870f3 100644 --- a/README.md +++ b/README.md @@ -6,9 +6,7 @@

- A - Material Design - theme for + A powerful documentation framework on top of MkDocs

@@ -19,19 +17,15 @@ alt="Build" /> Downloads - Chat on Gitter - Python Package Index - Docker Pulls

@@ -39,7 +33,7 @@

Write your documentation in Markdown and create a professional static site for your Open Source or commercial project in minutes – searchable, customizable, - more than 50 languages, for all devices. + more than 60 languages, for all devices.

@@ -50,7 +44,7 @@

- Check out the demo – + Check out the demo – squidfunk.github.io/mkdocs-material. @@ -107,9 +101,6 @@ - @@ -122,18 +113,15 @@ - - + /> --> @@ -143,6 +131,36 @@ + + + + + + + + + +

 

@@ -208,10 +226,12 @@ For detailed installation instructions, configuration options, and a demo, visit ### ... industry leaders +[ArXiv](https://info.arxiv.org), [Atlassian](https://atlassian.github.io/data-center-helm-charts/), [AWS](https://aws.github.io/copilot-cli/), [Bloomberg](https://bloomberg.github.io/selekt/), [CERN](http://abpcomputing.web.cern.ch/), +[CloudFlare](https://cloudflare.github.io/itty-router-openapi/), [Datadog](https://datadoghq.dev/integrations-core/), [Google](https://google.github.io/accompanist/), [Hewlett Packard](https://hewlettpackard.github.io/squest/), @@ -222,14 +242,16 @@ For detailed installation instructions, configuration options, and a demo, visit [Microsoft](https://microsoft.github.io/code-with-engineering-playbook/), [Mozilla](https://mozillafoundation.github.io/engineering-handbook/), [Netflix](https://netflix.github.io/titus/), +[Red Hat](https://ansible.readthedocs.io/projects/lint/), [Salesforce](https://policy-sentry.readthedocs.io/en/latest/), -[SoundCloud](https://intervene.dev/), +[Slack](https://slackhq.github.io/circuit/), [Square](https://square.github.io/okhttp/), [Zalando](https://opensource.zalando.com/skipper/) ### ... and successful Open Source projects [Arduino](https://arduino.github.io/arduino-cli/), +[Auto-GPT](https://docs.agpt.co/), [AutoKeras](https://autokeras.com/), [BFE](https://www.bfe-networks.net/), [CentOS](https://docs.infra.centos.org/), @@ -240,17 +262,18 @@ For detailed installation instructions, configuration options, and a demo, visit [Knative](https://knative.dev/docs/), [Kubernetes](https://kops.sigs.k8s.io/), [kSQL](https://docs.ksqldb.io/), -[MindsDB](https://docs.mindsdb.com/), [Nokogiri](https://nokogiri.org/), [OpenFaaS](https://docs.openfaas.com/), [Percona](https://docs.percona.com/percona-monitoring-and-management/), [Pi-Hole](https://docs.pi-hole.net/), [Pydantic](https://pydantic-docs.helpmanual.io/), +[PyPI](https://docs.pypi.org/), [Renovate](https://docs.renovatebot.com/), [Traefik](https://docs.traefik.io/), -[Trivy](https://github.com/aquasecurity/trivy) +[Trivy](https://aquasecurity.github.io/trivy/), [Vapor](https://docs.vapor.codes/), [ZeroNet](https://zeronet.io/docs/), +[WebKit](https://docs.webkit.org/), [WTF](https://wtfutil.com/) ## License diff --git a/docs/assets/screenshots/social-cards-accent.png b/docs/assets/screenshots/social-cards-accent.png new file mode 100644 index 000000000..8531f694e Binary files /dev/null and b/docs/assets/screenshots/social-cards-accent.png differ diff --git a/docs/assets/screenshots/social-cards-debug.png b/docs/assets/screenshots/social-cards-debug.png new file mode 100644 index 000000000..bef1c0a91 Binary files /dev/null and b/docs/assets/screenshots/social-cards-debug.png differ diff --git a/docs/assets/screenshots/social-cards-invert.png b/docs/assets/screenshots/social-cards-invert.png new file mode 100644 index 000000000..156a4e968 Binary files /dev/null and b/docs/assets/screenshots/social-cards-invert.png differ diff --git a/docs/assets/screenshots/social-cards-layer-0.png b/docs/assets/screenshots/social-cards-layer-0.png new file mode 100644 index 000000000..063d5f970 Binary files /dev/null and b/docs/assets/screenshots/social-cards-layer-0.png differ diff --git a/docs/assets/screenshots/social-cards-layer-1.png b/docs/assets/screenshots/social-cards-layer-1.png new file mode 100644 index 000000000..af66e76c0 Binary files /dev/null and b/docs/assets/screenshots/social-cards-layer-1.png differ diff --git a/docs/assets/screenshots/social-cards-layer-2.png b/docs/assets/screenshots/social-cards-layer-2.png new file mode 100644 index 000000000..05efa9d65 Binary files /dev/null and b/docs/assets/screenshots/social-cards-layer-2.png differ diff --git a/docs/assets/screenshots/social-cards-layer-3.png b/docs/assets/screenshots/social-cards-layer-3.png new file mode 100644 index 000000000..1511b99f8 Binary files /dev/null and b/docs/assets/screenshots/social-cards-layer-3.png differ diff --git a/docs/assets/screenshots/social-cards-layer-4.png b/docs/assets/screenshots/social-cards-layer-4.png new file mode 100644 index 000000000..45ad3cd7b Binary files /dev/null and b/docs/assets/screenshots/social-cards-layer-4.png differ diff --git a/docs/assets/screenshots/social-cards-layer-5.png b/docs/assets/screenshots/social-cards-layer-5.png new file mode 100644 index 000000000..7595600fc Binary files /dev/null and b/docs/assets/screenshots/social-cards-layer-5.png differ diff --git a/docs/assets/screenshots/social-cards-layer-background-color.png b/docs/assets/screenshots/social-cards-layer-background-color.png new file mode 100644 index 000000000..95ade5167 Binary files /dev/null and b/docs/assets/screenshots/social-cards-layer-background-color.png differ diff --git a/docs/assets/screenshots/social-cards-layer-background-image.png b/docs/assets/screenshots/social-cards-layer-background-image.png new file mode 100644 index 000000000..d66cff14a Binary files /dev/null and b/docs/assets/screenshots/social-cards-layer-background-image.png differ diff --git a/docs/assets/screenshots/social-cards-layer-background.png b/docs/assets/screenshots/social-cards-layer-background.png new file mode 100644 index 000000000..11d0f99f6 Binary files /dev/null and b/docs/assets/screenshots/social-cards-layer-background.png differ diff --git a/docs/assets/screenshots/social-cards-layer-icon-circles.png b/docs/assets/screenshots/social-cards-layer-icon-circles.png new file mode 100644 index 000000000..c30d86f4c Binary files /dev/null and b/docs/assets/screenshots/social-cards-layer-icon-circles.png differ diff --git a/docs/assets/screenshots/social-cards-layer-icon.png b/docs/assets/screenshots/social-cards-layer-icon.png new file mode 100644 index 000000000..d3b82acbf Binary files /dev/null and b/docs/assets/screenshots/social-cards-layer-icon.png differ diff --git a/docs/assets/screenshots/social-cards-layer-size.png b/docs/assets/screenshots/social-cards-layer-size.png new file mode 100644 index 000000000..a0a260ed3 Binary files /dev/null and b/docs/assets/screenshots/social-cards-layer-size.png differ diff --git a/docs/assets/screenshots/social-cards-layer-typography-align.png b/docs/assets/screenshots/social-cards-layer-typography-align.png new file mode 100644 index 000000000..e05e4ab4d Binary files /dev/null and b/docs/assets/screenshots/social-cards-layer-typography-align.png differ diff --git a/docs/assets/screenshots/social-cards-layer-typography-ellipsis.png b/docs/assets/screenshots/social-cards-layer-typography-ellipsis.png new file mode 100644 index 000000000..34750aebf Binary files /dev/null and b/docs/assets/screenshots/social-cards-layer-typography-ellipsis.png differ diff --git a/docs/assets/screenshots/social-cards-layer-typography-shrink.png b/docs/assets/screenshots/social-cards-layer-typography-shrink.png new file mode 100644 index 000000000..82670c3b5 Binary files /dev/null and b/docs/assets/screenshots/social-cards-layer-typography-shrink.png differ diff --git a/docs/assets/screenshots/social-cards-layer-typography.png b/docs/assets/screenshots/social-cards-layer-typography.png new file mode 100644 index 000000000..c4e97c7f2 Binary files /dev/null and b/docs/assets/screenshots/social-cards-layer-typography.png differ diff --git a/docs/assets/screenshots/social-cards-variant.png b/docs/assets/screenshots/social-cards-variant.png new file mode 100644 index 000000000..7bdaae397 Binary files /dev/null and b/docs/assets/screenshots/social-cards-variant.png differ diff --git a/docs/assets/screenshots/social-cards.png b/docs/assets/screenshots/social-cards.png index 3b348db34..40c51d7bd 100644 Binary files a/docs/assets/screenshots/social-cards.png and b/docs/assets/screenshots/social-cards.png differ diff --git a/docs/blog/.authors.yml b/docs/blog/.authors.yml index 1e2b34d3b..e5fbca3e7 100644 --- a/docs/blog/.authors.yml +++ b/docs/blog/.authors.yml @@ -1,4 +1,5 @@ -squidfunk: - name: Martin Donath - description: Creator - avatar: https://avatars.githubusercontent.com/u/932156 +authors: + squidfunk: + name: Martin Donath + description: Creator + avatar: https://avatars.githubusercontent.com/u/932156 diff --git a/docs/blog/posts/blog-support-just-landed.md b/docs/blog/posts/blog-support-just-landed.md index 6b65a7048..cd4a06bd4 100644 --- a/docs/blog/posts/blog-support-just-landed.md +++ b/docs/blog/posts/blog-support-just-landed.md @@ -8,7 +8,7 @@ categories: - Blog links: - Getting started with Insiders: insiders/getting-started.md#requirements - - setup/setting-up-a-blog.md#built-in-blog-plugin + - plugins/blog.md --- # Blog support just landed @@ -31,7 +31,7 @@ _This article explains how to build a standalone blog with Material for MkDocs. If you want to build a blog alongside your documentation, please refer to [the plugin's documentation][built-in blog plugin]._ - [built-in blog plugin]: ../../setup/setting-up-a-blog.md#built-in-blog-plugin + [built-in blog plugin]: ../../plugins/blog.md [Jekyll]: https://jekyllrb.com/ ## Quick start @@ -168,9 +168,9 @@ In velit purus, dictum quis neque nec, molestie viverra risus. Nam pellentesque tellus id elit ultricies, vel finibus erat cursus. ``` -1. If you mark a post as a [draft], a red marker appears next to the post date - on index pages. When the site is built, drafts are not included in the - output. [This behavior can be changed], e.g. for rendering drafts when +1. If you mark a post as a [draft], a red marker appears next to the post date + on index pages. When the site is built, drafts are not included in the + output. [This behavior can be changed], e.g. for rendering drafts when building deploy previews. When you spin up the [live preview server], you should be greeted by your first @@ -233,7 +233,7 @@ Some ideas already proposed by users: part of a series, a list with links to all other posts should be included in the post's content. -- __Author indexes__: Besides [archive] and [category] indexes, authors should +- __Author indexes__: Besides [archive] and [category] indexes, authors should be able to create per-author indexes, which list all posts linked to an author. Additionally, a profile should be created for each author and linked from posts. diff --git a/docs/blog/posts/chinese-search-support.md b/docs/blog/posts/chinese-search-support.md index cf675cd61..0652696b4 100644 --- a/docs/blog/posts/chinese-search-support.md +++ b/docs/blog/posts/chinese-search-support.md @@ -3,25 +3,25 @@ date: 2022-05-05 authors: [squidfunk] title: Chinese search support description: > - Insiders adds Chinese language support for the built-in search plugin – a + Insiders adds Chinese language support for the built-in search plugin – a feature that has been requested many times categories: - Search links: - blog/posts/search-better-faster-smaller.md - - setup/setting-up-site-search.md#chinese-language-support + - plugins/search.md#segmentation - insiders/index.md#how-to-become-a-sponsor --- # Chinese search support – 中文搜索​支持 -__Insiders adds experimental Chinese language support for the [built-in search +__Insiders adds experimental Chinese language support for the [built-in search plugin] – a feature that has been requested for a long time given the large number of Chinese users.__ After the United States and Germany, the third-largest country of origin of Material for MkDocs users is China. For a long time, the [built-in search plugin] -didn't allow for proper segmentation of Chinese characters, mainly due to +didn't allow for proper segmentation of Chinese characters, mainly due to missing support in [lunr-languages] which is used for search tokenization and stemming. The latest Insiders release adds long-awaited Chinese language support for the built-in search plugin, something that has been requested by many users. @@ -35,7 +35,7 @@ _This article explains how to set up Chinese language support for the built-in search plugin in a few minutes._ { style="display: inline" } - [built-in search plugin]: ../../setup/setting-up-site-search.md#built-in-search-plugin + [built-in search plugin]: ../../plugins/search.md [lunr-languages]: https://github.com/MihaiValentin/lunr-languages ## Configuration @@ -49,8 +49,8 @@ through the segmenter. You can install [jieba] with: pip install jieba ``` -The next step is only required if you specified the [`separator`][separator] -configuration in `mkdocs.yml`. Text is segmented with [zero-width whitespace] +The next step is only required if you specified the [`separator`][separator] +configuration in `mkdocs.yml`. Text is segmented with [zero-width whitespace] characters, so it renders exactly the same in the search modal. Adjust `mkdocs.yml` so that the [`separator`][separator] includes the `\u200b` character: @@ -65,14 +65,14 @@ That's all that is necessary. ## Usage -If you followed the instructions in the configuration guide, Chinese words will +If you followed the instructions in the configuration guide, Chinese words will now be tokenized using [jieba]. Try searching for -[:octicons-search-24: 支持][q=支持] to see how it integrates with the +[:octicons-search-24: 支持][q=支持] to see how it integrates with the built-in search plugin. --- -Note that this is an experimental feature, and I, @squidfunk, am not +Note that this is an experimental feature, and I, @squidfunk, am not proficient in Chinese (yet?). If you find a bug or think something can be improved, please [open an issue]. diff --git a/docs/blog/posts/excluding-content-from-search.md b/docs/blog/posts/excluding-content-from-search.md index 6c7b0d7b5..d84ef54c1 100644 --- a/docs/blog/posts/excluding-content-from-search.md +++ b/docs/blog/posts/excluding-content-from-search.md @@ -119,7 +119,7 @@ search: exclude: true --- -# Document title +# Page title ... ``` @@ -133,7 +133,7 @@ filtered by the search plugin before the page is rendered: === ":octicons-file-code-16: `docs/page.md`" ``` markdown - # Document title + # Page title ## Section 1 @@ -173,7 +173,7 @@ supported by the [Attribute Lists] extension: === ":octicons-file-code-16: `docs/page.md`" ``` markdown - # Document title + # Page title The content of this block is included diff --git a/docs/blog/posts/search-better-faster-smaller.md b/docs/blog/posts/search-better-faster-smaller.md index a6375d867..5e3ab2d3d 100644 --- a/docs/blog/posts/search-better-faster-smaller.md +++ b/docs/blog/posts/search-better-faster-smaller.md @@ -9,7 +9,7 @@ categories: - Search - Performance links: - - setup/setting-up-site-search.md#built-in-search-plugin + - plugins/search.md - insiders/index.md#how-to-become-a-sponsor --- @@ -58,7 +58,7 @@ const index$ = document.forms.namedItem("search") [lunr]: https://lunrjs.com [lunr-languages]: https://github.com/MihaiValentin/lunr-languages - [built-in search plugin]: ../../setup/setting-up-site-search.md#built-in-search-plugin + [built-in search plugin]: ../../plugins/search.md ### Search index @@ -176,10 +176,10 @@ which creates and manages the [lunr] search index. When search is initialized, the following steps are taken: [^1]: - Prior to :octicons-tag-24: 5.0.0, search was carried out in the main thread - which locked up the browser, rendering it unusable. This problem was first - reported in #904 and, after some back and forth, fixed and released in - :octicons-tag-24: 5.0.0. + Prior to , search was carried out in the main + thread which locked up the browser, rendering it unusable. This problem was + first reported in #904 and, after some back and forth, fixed and released in + . 1. __Linking sections with pages__: The search index is parsed, and each section is linked to its parent page. The parent page itself is _not @@ -196,7 +196,7 @@ the following steps are taken: > can achieve with a tokenizer that is capable of separating strings with > lookahead. -1. __Indexing__: As a final step, each section is indexed. When querying the +3. __Indexing__: As a final step, each section is indexed. When querying the index, if a search query includes one of the tokens as returned by step 2., the section is considered to be part of the search result and passed to the main thread. @@ -244,7 +244,7 @@ carefully considered: stopping at a whitespace character when enough words have been consumed. A preview might look like this: - ``` + ``` … channels, e.g., or which can be configured via mkdocs.yml … ``` @@ -262,7 +262,7 @@ carefully considered: China and Japan are both within the top 5 countries of origin of users of Material for MkDocs. - [truncated]: https://github.com/squidfunk/mkdocs-material/blob/master/src/assets/javascripts/templates/search/index.tsx#L90 + [truncated]: https://github.com/squidfunk/mkdocs-material/blob/master/src/templates/assets/javascripts/templates/search/index.tsx#L90 [search preview]: search-better-faster-smaller/search-preview.png [Just the Docs]: https://pmarsceill.github.io/just-the-docs/ [Docusaurus]: https://github.com/lelouch77/docusaurus-lunr-search @@ -286,7 +286,7 @@ it brings: - __Better__: support for [rich search previews], preserving the structural information of code blocks, inline code, and lists, so they are rendered - as-is, as well as [lookahead tokenization], [more accurate highlighting], and + as-is, as well as [lookahead tokenization], [more accurate highlighting], and improved stability of typeahead. Also, a [slightly better UX]. - __Faster__ and __smaller__: significant decrease in search index size of up to 48% due to improved extraction and construction techniques, resulting in a @@ -463,7 +463,7 @@ also demonstrates that this now even works properly for search queries.[^5] [^5]: Previously, the search query was not correctly tokenized due to the way - [lunr] treats wildcards, as it disables the pipeline for search terms that + [lunr] treats wildcards, as it disables the pipeline for search terms that contain wildcards. In order to provide a good typeahead experience, Material for MkDocs adds wildcards to the end of each search term not explicitly preceded with `+` or `-`, effectively disabling tokenization. @@ -499,7 +499,7 @@ following expression to the separator allows for just that: &[lg]t; ``` -Searching for [:octicons-search-24: custom search worker script][q=script] +Searching for [:octicons-search-24: custom search worker script][q=script] brings up the section on [custom search] and matches the `script` tag among the other search terms discovered. @@ -548,7 +548,7 @@ powerful as tokenization: Now, only the content blocks that actually contain occurrences of one of the search terms are considered for inclusion into the search preview. If a term only occurs in a code block, it's the code block that gets rendered, - see, for example, the results of + see, for example, the results of [:octicons-search-24: twitter][q=twitter]. [regular expressions]: https://github.com/squidfunk/mkdocs-material/blob/ec7ccd2b2d15dd033740f388912f7be7738feec2/src/assets/javascripts/integrations/search/highlighter/index.ts#L61-L91 diff --git a/docs/browser-support.md b/docs/browser-support.md index e24d4fb93..7cf4f5af9 100644 --- a/docs/browser-support.md +++ b/docs/browser-support.md @@ -47,6 +47,8 @@ check the distribution of browser types and versions among your users. [open an issue]: https://github.com/squidfunk/mkdocs-material/issues/new/choose [caniuse.com]: https://caniuse.com/ [:is pseudo selector]: https://caniuse.com/css-matches-pseudo + [browser support]: #supported-browsers + [built-in privacy plugin]: plugins/privacy.md ## Other browsers @@ -62,6 +64,4 @@ the following older browser versions might work with some additional effort: - :fontawesome-brands-internet-explorer: __Internet Explorer__ - no support, mainly due to missing support for [custom properties]. The last version of Material for MkDocs to support Internet Explorer is - [:octicons-tag-24: 4.6.3][IE support]. - - [IE support]: https://github.com/squidfunk/mkdocs-material/releases/tag/4.6.3 + . diff --git a/docs/changelog/index.md b/docs/changelog/index.md index d629a059d..18bdb9cc7 100644 --- a/docs/changelog/index.md +++ b/docs/changelog/index.md @@ -2,6 +2,211 @@ ## Material for MkDocs +### 9.3.2 September 19, 2023 { id="9.3.2" } + +- Updated Slovenian translations +- Updated Python dependencies in requirements to use minimum versions +- Fixed #6017: Code highlighting inconsistent in Community and Insiders edition +- Fixed #6001: Contributor avatars display incorrectly in Firefox +- Fixed #6000: Blog post drafts are included in navigation + +### 9.3.1 September 11, 2023 { id="9.3.1" } + +- Fixed crash of group plugin when used together with hooks + +### 9.3.0 September 11, 2023 { id="9.3.0" } + +- Improved configuration sharing between Community and Insiders edition +- Added experimental built-in group plugin for enabling plugins conditionally +- Added new settings in tags plugin for enabling/disabling +- Dropped support for Python 3.7 (EOL) + +### 9.2.8 September 4, 2023 { id="9.2.8" } + +- Updated Italian and Russian translations +- Fixed #5952: Combining blog and tags plugin leads to wrong links +- Fixed #5951: Blog plugin ignores post title in metadata +- Fixed #5949: Blog plugin ignores post linked in nav + +### 9.2.7 September 2, 2023 { id="9.2.7" } + +- Switched dependencies to compatible release clauses +- Removed `readtime` and `lxml` dependencies for blog plugin +- Reduced size of Docker image to improve CI build performance +- Fixed #5945: Incorrect footer navigation for sibling pages of blog +- Fixed #5939: Page jumps when changing color palette (Firefox 117) +- Fixed #5901: Announcement bar reappears when using instant loading +- Fixed #5824: Allow to customize styles of sequence diagrams + +### 9.2.6 August 31, 2023 { id="9.2.6" } + +- Added Basque translations +- Added template for simple redirects +- Improved blog plugin interop by moving view generation to `on_files` +- Fixed #5924: Social plugin still checks dependencies when disabled +- Fixed #5916: Blog plugin crashes on Python 3.8 (9.2.0 regression) + +### 9.2.5 August 27, 2023 { id="9.2.5" } + +- Fixed error in dirty serve mode when using blog plugin +- Fixed page title not being consistent in blog plugin pagination +- Fixed #5899: Blog plugin pagination breaks when disabling directory URLs + +### 9.2.4 August 26, 2023 { id="9.2.4" } + +- Added version to bug report name in info plugin +- Updated Afrikaans translations + +### 9.2.3 August 22, 2023 { id="9.2.3" } + +- Fixed blog plugin rendering wrongly with `markdown.extensions.toc` +- Fixed blog plugin entrypoint generation + +### 9.2.2 August 22, 2023 { id="9.2.2" } + +- Fixed #5880: Blog plugin failing when building a standalone blog +- Fixed #5881: Blog plugin not compatible with Python < 3.10 + +### 9.2.1 August 21, 2023 { id="9.2.1" } + +- Fixed #5879: Blog plugin failing when building a standalone blog +- Fixed error in blog plugin when using draft tagging on future date +- Fixed error in blog plugin when toc extension is not enabled + +### 9.2.0 August 21, 2023 { id="9.2.0" } + +__Additions and improvements__ + +- Added blogging support via built-in blog plugin +- Added support for Chinese language segmentaiton in search plugin +- Added support for adding custom dates to blog posts +- Added support for paginating archive and category pages +- Added support for annotations (outside of code blocks) +- Added support for navigation icons +- Added support for navigation pruning +- Added support for navigation status +- Added support for customizing site icons +- Added support for customizing (code) annotation icons +- Added focus outline to admonitions and details +- Added prompt for bug report name to info plugin +- Added Luxembourgish translations +- Improved rendering of (code) annotation markers +- Improved print styles for (code) annotations +- Improved customizability of navigation tabs +- Improved interop of plugins with external tools like mike +- Improved interop of blog plugin with awesome pages plugin +- Improved header partial by moving buttons into separate partials +- Improved clarity of `site_url` warning in social plugin +- Improved blog plugin to automatically setup directory structure +- Switched info plugin to `importlib` to mitigate deprecations +- Automatically download ResizeObserver polyfill when necessary +- Automatically add iframe-worker polyfill when necessary in offline plugin +- Automatically focus and bring up keyboard on touch devices +- Updated Serbo-Croatian translations +- Updated MkDocs to 1.5.2 + +__Removals__ + +- Removed Universal Analytics integration +- Removed ancient polyfills to reduce size of bundled JavaScript by 20% +- Removed necessity for `Array.flat` and `Array.flatMap` polyfill +- Removed announcement bar button when JavaScript is not available + +__Fixes__ + +- Fixed rendering of tags when announcement bar is present +- Fixed tags plugin rendering pages excluded by other plugins +- Fixed #5132: Blog plugin requires `nav` entry in `mkdocs.yml` +- Fixed #5599: Insufficient contrast for default link color +- Fixed #5715: Blog plugin missing integrated table of contents in pagination +- Fixed #5806: Version selector not hoverable on some Android devices +- Fixed #5826: Blog post drafts with tags show up in tags index + +### 9.1.21 July 27, 2023 { id="9.1.21" } + +- Fixed MkDocs 1.4 compat issue in social plugin (9.1.20 regression) + +### 9.1.20 July 27, 2023 { id="9.1.20" } + +- Updated Sanskrit translations +- Fixed deprecation warnings for social plugin + +### 9.1.19 July 18, 2023 { id="9.1.19" } + +- Added support for MkDocs 1.5+ +- Fixed #5699: Improve error reporting in social plugin + +### 9.1.18 July 3, 2023 { id="9.1.18" } + +- Updated Danish translations +- Added support for installing user requirements in Docker image +- Fixed #5655: Search separator with lookbehind breaks highlighting + +### 9.1.17 June 23, 2023 { id="9.1.17" } + +- Fixed #5633: Code annotations with nested lists incorrectly mounted +- Fixed #5628: Regression in new social plugin configuration scheme + +### 9.1.16 June 15, 2023 { id="9.1.16" } + +- Updated Indonesian translations +- Ensure scroll bar follows color scheme of operating system + +### 9.1.15 May 29, 2023 { id="9.1.15" } + +- Fixed #5566: Indicate color scheme to operating system +- Fixed #5565: Update `Dockerfile` to latest version of base image +- Fixed #5554: Add additional version tags (`9`, `9.1`) to Docker image +- Fixed #5536: Strip tags of ARIA labels in table of contents + +### 9.1.14 May 20, 2023 { id="9.1.14" } + +- Updated Armenian and Greek translations + +### 9.1.13 May 16, 2023 { id="9.1.13" } + +- Fixed #5517: Social plugin crashes for some fonts (e.g. Open Sans) + +### 9.1.12 May 12, 2023 { id="9.1.12" } + +- Updated Bengali (Bangla) translations +- Fixed #5503: Docker image publish errors on uppercase characters +- Fixed #5407: Auto-pause media when in hidden content tabs + +### 9.1.11 May 8, 2023 { id="9.1.11" } + +- Fixed #5487: Social plugin crashes without options (9.1.10 regression) + +### 9.1.10 May 8, 2023 { id="9.1.10" } + +- Added `cards_layout_options` setting for social cards +- Deprecated `cards_color` and `cards_font` setting for social cards + +### 9.1.9 May 2, 2023 { id="9.1.9" } + +- Added Telugu, Kannada and Sanskrit translations +- Fixed #5428: Fixed margins for light/dark mode images in figures +- Fixed #5420: Social plugin crashing for some specific Google Fonts +- Fixed #5160: Instant loading makes code annotations jump (9.1.1 regression) +- Fixed #4920: Social plugin not loading logo from custom icon set +- Fixed social plugin crashing when only code font is specified + +### 9.1.8 April 24, 2023 { id="9.1.8" } + +- Fixed #5417: Theme breaks when `palette` is not defined (9.1.7 regression) + +### 9.1.7 April 22, 2023 { id="9.1.7" } + +- Updated Persian (Farsi) and Turkish translations +- Fixed #5401: Added missing flag to disable built-in tags plugin +- Fixed #5206: Ensure defaults are set for primary and accent colors +- Fixed unnecessary inclusion of palette CSS when unused + +### 9.1.6 April 7, 2023 { id="9.1.6" } + +- Updated Persian (Farsi) translations +- Fixed #5300: Boxes in Mermaid sequence diagrams not color-abiding + ### 9.1.5 March 31, 2023 { id="9.1.5" } - Updated Lithuanian and Japanese translations @@ -103,7 +308,7 @@ ### 9.0.7 January 28, 2023 { id="9.0.7" } - Improved accessibility of sidebar navigation -- Moved all translations into community edition +- Moved all translations into Community edition - Updated Polish and Portuguese (Brasilian) translations - Fixed info plugin terminating on subsequent reload when serving - Fixed #4910: Sidebar navigation labels have invalid ARIA roles diff --git a/docs/contributing/adding-a-translation.md b/docs/contributing/adding-a-translation.md deleted file mode 100644 index b3741e0fd..000000000 --- a/docs/contributing/adding-a-translation.md +++ /dev/null @@ -1,236 +0,0 @@ -# Adding a translation - -We can't believe it ourselves but with the help of community contribution, -Material for MkDocs already supports 50+ languages. As you can imagine, it's -impossible for us maintainers to keep all languages up-to-date (we just don't -speak 50+ languages). That's why we need the help of our international community -to help us add new or update translations, as new feature releases sometimes -require new translations. - -If you would like to help us to make Material for MkDocs more globally -accessible and have noticed a missing translation in your language or want to -add a new one. In that case, we have simplified the contributing process for you. -Just follow the few steps of the guide below. - -## Before adding a translation - -Given the constant expansion of our project and the frequent translation updates, -it is essential to check the following things before submitting a translation -contribution. - -### List of supported languages - -Chances are your language is already supported by Material for MkDocs. To check -if your language is supported or needs improvements and updates, we would advise -you to check the [list of supported languages]. - -[:material-earth-plus:  Search for your language][Search for your language]{ .md-button .md-button--primary } - - [list of supported languages]: https://squidfunk.github.io/mkdocs-material/setup/changing-the-language/#site-language - [Search for your language]: https://squidfunk.github.io/mkdocs-material/setup/changing-the-language/#site-language - -In case your language is already supported, you can add **missing translations**, -displayed below each language. If your language is not on the list of supported -languages, you can contribute translations by opening a new issue and -[adding a translation] by following the guide below. - -> __Please note,__ that we use region designators in conjunction with regions, -> and cluster all languages using language designators with regions. Language -> region designators consist of codes that represent countries and follow the -> [ISO 3166-1 standard], which employs two-letter capitalized codes. If you need -> to specify a particular dialect, please utilize this system by hyphenating a -> language designator with a region designator. For instance, to specify the -> British English, use the "en" language designator and indicate the locale as -> "en-GB." - - [Adding a translation]: https://github.com/squidfunk/mkdocs-material/issues/new?assignees=&labels=change+request&template=04-add-a-translation.yml&title=Add+translations+for+... - [ISO 3166-1 standard]: https://lingohub.com/developers/supported-locales/language-designators-with-regions - -### Issue tracker - -Our issue tracker might already contain an open issue with a contribution with -missing translations for your language that still needs to be integrated by us -maintainers. To avoid investing your time in duplicated work, please search the -[issue tracker] beforehand. - -[:octicons-issue-opened-24:  Search our issue tracker][Search our issue tracker]{ .md-button .md-button--primary } - - [issue tracker]: https://github.com/squidfunk/mkdocs-material/issues - [search our issue tracker]: https://github.com/squidfunk/mkdocs-material/issues - -### Update supported languages - -Have you noticed that other users haven't yet updated your language? You are -welcome to contribute and add any missing translations by clicking the link -provided underneath each language in the [list of supported languages]. This -link will direct you to a new issue template that is pre-filled with all the -necessary information. Any fields that can be adjusted will be highlighted for -your convenience. - -[:material-translate-variant:  Add missing translations][Update your translations]{ .md-button .md-button--primary } - - [List of supported languages]: https://squidfunk.github.io/mkdocs-material/setup/changing-the-language/#site-language - [Update your translations]: https://squidfunk.github.io/mkdocs-material/setup/changing-the-language/#site-language - ---- - -At this point, when you have made sure that Material for MkDocs doesn't already -support your language you can add translations for it by following the issue -template. - -## Issue template - -We have created a new issue template to make contributing translations for new -languages as simple as possible. It is the result of our experience with 50+ -language contributions and updates over the last couple of years. We recently -simplified the language contribution process, and the new template consists of the -following parts: - -- [Title] -- [Translations] -- [Country flag] optional -- [Checklist] - - [Title]: #title - [Translations]: #translations - [Country flag]: #country-flag - [Checklist]: #checklist - -### Title - -Translation issue titles are simple. When adding a new language, the first part -of the title with "Add translations for..." is already pre-filled in the -template, and you need to replace the three dots with your language name. If -adding missing translations for a language from the [list of supported languages], -the title is already set with no need for adjustment. - -| | Example | -| -------- | -------- | -| :material-check:{ style="color: #4DB6AC" } __Clear__ | Add translations for German -| :material-close:{ style="color: #EF5350" } __Unclear__ | Add translations ... -| :material-close:{ style="color: #EF5350" } __Generic__ | German - - [List of supported languages]: https://squidfunk.github.io/mkdocs-material/setup/changing-the-language/#site-language - -### Translations - -With the preliminary work done, you can now add all missing translations for -your language. Each label on the right side containing the `⬅️ icon` is missing -a translation. To ensure the accuracy of your translation, consider double-checking -the context of the words by looking at the [English version]. - -After adding the translation, remove the `⬅️ icon` from each translated line. If -you don't know how to translate specific fields, simply leave them for other -contributors to complete. - -[English version]: https://github.com/squidfunk/mkdocs-material/tree/master/src/partials/languages/en.html - -#### Translation context - -TO DO MARTIN - explain the translation context -. -. - - -### Country flag - -Congratulations on contributing translations for a new language! To make it -easier for you and others to find the language in our list of supported -languages, please select the best-fitting flag for your language from our -documentation's [Icons, Emojis site] by entering the command `flag` in the -search field. - -!!! warning "Icon limitation by Twemoji" - - Please note that only icons provided by Twemoji can be used. If your flag is - not available on the list on the [Icons, Emojis site], please choose an - alternative. - -> __Why this might be helpful__: adding a country flag next to the country name -> can be helpful for you and for others to find the language in the list of -> supported languages faster and easier. If your country's flag is not supported -> by Temoji, it is best that you provide us with an alternative instead of us -> choosing one for you. - - [Icons, Emojis site]: https://squidfunk.github.io/mkdocs-material/reference/icons-emojis/#search - -### Checklist - -Thanks for following the guide and creating a high-quality and complete -translation issue – you are almost done. The checklist ensures that you have read -this guide and have worked to your best knowledge to provide us with everything -we need to know to integrate your contribution to Material for MkDocs. - -__We'll take it from here.__ - ---- - -## Authors credits - -Authors who submit a translation using the template above will be -__credited as co-authors__ in commits for Material for MkDocs. To list your -account as a co-author without knowing or revealing your email address, we will -use your GitHub-provided no-reply email, following -[GitHub's recommended workaround] to protect your privacy. This way, your -commit will count as a contribution without opening a pull request. - - [GitHub's recommended workaround]: https://docs.github.com/en/pull-requests/committing-changes-to-your-project/creating-and-editing-commits/creating-a-commit-with-multiple-authors - -## Contributing via pull request - -If you want to contribute missing translations by creating a pull request to be -listed as the sole author of the commit, you can open a PR after submitting the -translation issue. Ensure you thoroughly read the pull request guide below to -prevent breaking functionality in the translation file. - -1. Fill out a [translation issue] according to the guide and submit it in the - [issue tracker]. - -2. Tick the box for the last point in the "Before submitting..." section. - - [x] __Optional__: I want to integrate this translation myself and create a - pull request following the [contribution guide](https://github.com/squidfunk/mkdocs-material/blob/master/CONTRIBUTING.md). - -3. Fork the Material for MkDocs repository, set up a [development environment] -and create a separate git branch on which you make all your changes. - -4. Please review all [existing language files] in the repository and search for -your language. If a file for your language already exists, please use it for -your edits or create a new file if your language is not listed by copying one of -the existing files. - -5. Add the missing translations for your language to the best of your knowledge - and save the changes. - - !!! warning "Important" - Only add the translations that are different from the defaults. For - example, if your language is left-to-right, don't add the `direction` - translation, as English is also left-to-right. The following - translations are for technical purposes, and __should not be updated__. - If they're missing from your language, it's for a good reason: - - - `search.config.lang` - - `search.config.pipeline` - - `search.config.separator` - -6. Open the [English translations] file and compare your translations with the - up-to-date English translations file. - -7. Before submitting a pull request, build the theme. This is a mandatory -requirement for your PR to get accepted, as the theme should be installable -through GitHub at all times. - -8. After building the theme, commit the compiled output, push your branch to -GitHub and send a PR to mkdocs-material:master. If we suggest changes, make the -required updates, rebase your branch, and push the changes to your GitHub -repository, which will automatically update your PR. - -9. After your PR is merged, you can safely delete your branch and pull the -changes from the main (upstream) repository. - - [translation issue]: https://github.com/squidfunk/mkdocs-material/issues/new?assignees=&labels=change+request&template=04-add-a-translation.yml&title=Add+translations+for+... - [issue tracker]: https://github.com/squidfunk/mkdocs-material/issues/new/choose - [existing language files]: https://github.com/squidfunk/mkdocs-material/tree/master/src/partials/languages - [English translations]: https://github.com/squidfunk/mkdocs-material/tree/master/src/partials/languages/en.html - [development environment]: https://squidfunk.github.io/mkdocs-material/customization/#environment-setup - -__After your PR was merged by us maintainers, you can start using the new language.__ diff --git a/docs/contributing/adding-translations.md b/docs/contributing/adding-translations.md new file mode 100644 index 000000000..dbbc4edc7 --- /dev/null +++ b/docs/contributing/adding-translations.md @@ -0,0 +1,125 @@ +# Translations + +It's unbelievable – with the help of international community contributions, +Material for MkDocs has been translated into 60+ languages. As you can imagine, +it's impossible for us maintainers to keep all languages up-to-date, and new +features sometimes require new translations. + +If you would like to help us to make Material for MkDocs even more globally +accessible and have noticed a missing translation in your language, or would +like to add a new language, you can help us by following the steps of the guide +below. + +## Before creating an issue + +Translations change frequently, which is why we want to make sure that you don't +invest your time in duplicating work. Before adding translations, please check +the following things: + +### Check language availability + +With more than 60 languages, the chances are good that your language is already +supported by Material for MkDocs. You can check if your language is available, +or needs improvements or additional translations by inspecting the list of +[supported languages]: + +- __Your language is already supported__ – in this case, you can check if there + are translations missing, and click the link underneath your language to add them, which takes 5 minutes. + +- __Your language is missing__ – in that case, you can help us add support + for your language to Material for MkDocs! Read on, to learn how to do this. + + [supported languages]: ../setup/changing-the-language.md#site-language + +### Search our issue tracker + +Another user might have already created an issue supplying the missing +translations for your language that still needs to be integrated by us +maintainers. To avoid investing your time in duplicated work, please search the +[issue tracker] beforehand. + + [issue tracker]: https://github.com/squidfunk/mkdocs-material/issues + +--- + +At this point, when you have made sure that Material for MkDocs doesn't already +support your language, you can add new translations for it by following the +issue template. + +## Issue template + +We have created an issue template that makes contributing translations as simple +as possible. It is the result of our experience with 60+ language contributions +and updates over the last couple of years, and consists of the following parts: + +- [Title] +- [Translations] +- [Country flag] optional +- [Checklist] + + [Title]: #title + [Translations]: #translations + [Country flag]: #country-flag + [Checklist]: #checklist + +### Title + +When you update an already existing language, you can just leave the title as it +is. Adding support for a new language, replace the `...` in the pre-filled title +with the name of your language. + +| | Example | +| -------- | -------- | +| :material-check:{ style="color: #4DB6AC" } __Clear__ | Add translations for German +| :material-close:{ style="color: #EF5350" } __Unclear__ | Add translations ... +| :material-close:{ style="color: #EF5350" } __Useless__ | Help + +### Translations + +If a translation contains an :arrow_left: icon on the right side, it is missing. +You can translate this line and remove the :arrow_left: icon. If you don't know +how to translate specific lines, simply leave them for other contributors to +complete. To ensure the accuracy of your translation, consider double-checking the +context of the words by looking at our [English translations]. + +[English translations]: https://github.com/squidfunk/mkdocs-material/tree/master/src/partials/languages/en.html + +### Country flag optional { #country-flag } + +For a better overview, our list of [supported languages] includes country flags +next to the language names. You can help us select a flag for your language by +adding the shortcode for the country flag to this field. Go to our +[emoji search] and enter `flag` to find all available shortcodes. + +!!! question "What if my flag is not available?" + + [Twemoji] provides flag emojis for 260 countries – subdivisions of countries, + such as states, provinces, or regions, are not supported. If you're adding + translations for a subdivision, please choose the most appropriate available + flag. + + [Twemoji]: https://twemoji.twitter.com/ + [emoji search]: ../reference/icons-emojis.md#search + +> __Why this might be helpful__: adding a country flag next to the country name +> can be helpful for you and for others to find the language in the list of +> supported languages faster and easier. If your country's flag is not supported +> by [Twemoji], you can help us choose an alternative. + +### Checklist + +Thanks for following the guide and helping us to add new translations to Material +for MkDocs – you are almost done. The checklist ensures that you have read this +guide and have worked to your best knowledge to provide us with everything we need +to integrate your contribution. + +__We'll take it from here.__ + +--- + +## Attribution + +If you submit a translation using the template above, you will be __credited as +a co-author__ in the commit, so you don't need to open a pull request. You have +done a significant contribution to the project, making Material for MkDocs +accessible to more people around the world. Thank you! diff --git a/docs/contributing/index.md b/docs/contributing/index.md index 36f9f0b44..37cd5b086 100644 --- a/docs/contributing/index.md +++ b/docs/contributing/index.md @@ -1,206 +1,202 @@ # Contributing -Material for MkDocs is an actively maintained and constantly improved project -that serves a diverse user base with varying backgrounds and needs. In order to -effectively address the needs of all our users, evaluate requests, and fix bugs, -we maintainers need to put in a lot of work. +Material for MkDocs is an actively maintained and constantly evolving project +serving a diverse user base with versatile backgrounds and needs. In order to +efficiently address the requirements of all our users, evaluate change requests, +and fix bugs, we put in a lot of work. -Our community is pretty big and includes many active users who open new -discussions or issues multiple times a day, filling the [issue tracker] or the -[discussion board] with a lot of valuable knowledge. As such, we consider our -issue tracker and discussion board to be a knowledge base that is an important -addition to our [documentation], and brings value to both new and experienced -users of Material for MkDocs. +Our ever-growing community includes many active users, who open new +issues and discussions several times a day, evolving our [issue tracker] and +[discussion board] into a knowledge base – an important addition to +our [documentation] – yielding value to both new and experienced users. -## How to contribute + [discussion board]: https://github.com/squidfunk/mkdocs-material/discussions + [issue tracker]: https://github.com/squidfunk/mkdocs-material/issues + [documentation]: https://squidfunk.github.io/mkdocs-material/ -We've invested time and effort into making our [issue tracker] and [discussion board] -as user-friendly as possible. We understand that reporting bugs, -requesting features, and engaging with our community can be challenging, so -we've optimized our templates and added guidelines to improve all overall -interaction within this project. +## How you can contribute -Our goal is to ensure that our platform is __well-structured__, __easy to navigate__, -and __searchable__, so you can find what you need quickly and efficiently. We've -also optimized our templates to help us understand your needs better, so we can -provide you with faster and more effective support. In this documentation -section, we'll give you an overview of each process and guide you to the -detailed subpages. +We understand that reporting bugs, raising change requests, as well as engaging +in discussions can be time-consuming, which is why we've carefully optimized our +issue templates and defined guidelines to improve the overall interaction +within the project. We've invested a lot of time and effort into making our +[issue tracker] and [discussion board] as efficient as possible. +Our goal is to ensure that our documentation, as well as issue tracker and +discussion board, are __well-structured__, __easy to navigate__, and +__searchable__, so you can find what you need quickly and efficiently. Thus, +when you follow our guidelines, we can help you much faster. + +In this section, we guide your through our processes. ### Creating an issue
-- :material-bug:{ .lg .middle } __Something is not working?__ +- :material-bug-outline:   + __Something is not working?__ --- - Report a bug in Material for MkDocs by creating an issue with a reproduction + Report a bug in Material for MkDocs by creating an issue with a + reproduction + + --- [:octicons-arrow-right-24: Report a bug][report a bug] -- :material-file-document:{ .lg .middle } __Missing information in our docs?__ +- :material-file-document-remove-outline:   + __Missing information in our docs?__ --- - Report missing information or potential inconsistencies in our documentation + Report missing information or potential inconsistencies in our + documentation + + --- [:octicons-arrow-right-24: Report a docs issue][report a docs issue] -- :material-lightbulb-on:{ .lg .middle } __Want to submit an idea?__ +- :material-lightbulb-on-20:   + __Want to submit an idea?__ --- Propose a change, feature request, or suggest an improvement + --- + [:octicons-arrow-right-24: Request a change][request a change] -- :material-chat-question:{ .lg .middle } __Have a question or need help?__ +- :material-account-question-outline:   + __Have a question or need help?__ --- - Ask a question on our discussion board and get in touch with our community + Ask a question on our [discussion board] and get in touch with our + community - [:octicons-arrow-right-24: Ask a question][ask a question] + --- + + [:octicons-arrow-right-24: Ask a question][discussion board]
-### Contributing to this project +### Contributing
-- :material-translate-variant:{ .lg .middle } __Missing support for your language?__ +- :material-translate:   + __Missing support for your language?__ --- - Add missing translations for a new or supported language - - [:octicons-arrow-right-24: Add a translation](https://github.com/squidfunk/mkdocs-material/adding-a-translation) - -- :material-source-pull:{ .lg .middle } __Want to create a pull request?__ + Add or improve translations for a new or already supported language --- - Learn how to create a comprehensive pull request (PR) + [:octicons-arrow-right-24: Add a translation][add a translation] - [:octicons-arrow-right-24: Create a pull request](https://github.com/squidfunk/mkdocs-material/creating-a-pull-request) +- :material-source-pull:   + __Want to create a pull request?__ + + --- + + Learn how to create a comprehensive and useful pull request (PR) + + --- + + [:octicons-arrow-right-24: Create a pull request][create a pull request]
[report a bug]: reporting-a-bug.md [report a docs issue]: reporting-a-docs-issue.md [request a change]: requesting-a-change.md - [ask a question]: https://github.com/squidfunk/mkdocs-material/discussions + [add a translation]: https://github.com/squidfunk/mkdocs-material/adding-a-translation + [create a pull request]: https://github.com/squidfunk/mkdocs-material/pulls ---- +## Checklist -!!! warning "Issues, discussions, and comments are permanent" +Before interacting within the project, please take a moment to consider the +following questions. By doing so, you can ensure that you are using the correct +issue template and that you provide all necessary information when interacting +with our community. - Please note that everything you write is permanent and will remain - for everyone to read in this project forever. Therefore, be nice, follow - our contribution guidelines, and comply with our Code of Conduct. +!!! warning "Issues, discussions, and comments are forever" ---- + Please note that everything you write is permanent and will remain + for everyone to read – forever. Therefore, please always be nice and + constructive, follow our contribution guidelines, and comply with our + [Code of Conduct]. -## Before contributing +### Before creating an issue -Before interacting within this project, please take a moment to consider the -following questions. By doing so, you can ensure that you are using the correct -issue template or provide all necessary information when interacting with the -community: +- Are you using the appropriate issue template, or is there another issue + template that better fits the context of your request? -### Before submitting an issue, review: +- Have you checked if a similar bug report or change request has already been + created, or have you stumbled upon something that might be related? -- Am I using the right issue template for my [request], [report], or [contribution]? -- Have I checked if a similar issue or request has already been submitted? -- Did I fill out every field as requested? -- Did I provide all additional information others might need to comprehend my request? +- Did your fill out every field as requested and did you provide all additional + information we maintainers need to comprehend your request? - [request]: https://github.com/squidfunk/mkdocs-material/issues/new?assignees=&labels=&template=03-request-a-change.yml - [report]: https://github.com/squidfunk/mkdocs-material/issues/new?assignees=&labels=&template=01-report-a-bug.yml - [contribution]: https://github.com/squidfunk/mkdocs-material/issues/new?assignees=&labels=change+request&template=04-add-a-translation.yml&title=Add+translations+for+... +### Before asking a question -### Before asking a question, reconsider: +- Is the topic a question for our [discussion board], or is it a bug report or + change request that should better be raised on our [issue tracker]? -- Is there an open discussion on the topic of my request? -- Does my question fit the direction of the discussion, or should I open a new discussion? -- Is my topic a question for the discussion boards, or is it a bug report or idea request that requires a new issue? -- Did I provide the community with all the necessary information to comprehend my question? -- Have I checked if my question has been answered before? +- Is there an open discussion on the topic of your request? If the answer is yes, + does your question match the direction of the discussion, or should you open a + new discussion? -### Before leaving a comment, rethink: +- Did your provide our community with all the necessary information to + understand your question and help you quickly, or can you make it easier to + help you? -- Is my comment directly related to the topic of this page, e.g., blog post or discussion? -- Is it a comment or a request? -- Should I use the discussion board for my request or comment instead? -- Does my comment add value to the conversation? -- Is my comment respectful and constructive? +### Before commenting ---- +- Is your comment relevant to the topic of the current page, post, issue, or + discussion, or is it a better idea to create a new issue or discussion? -## Code of Conduct (CoC) +- Does your comment add value to the conversation? Is it constructive and + respectful to our community and us maintainers? Could you just use a + [:octicons-smiley-16: reaction][reaction] instead? -With a large community like ours, it's essential to follow the rules of our -[Code of Conduct] and value the standards of acceptable behavior. Please take a -moment to read through our [Code of Conduct], which can always be found -in full on our documentation. Please pay particular attention to our key values -and keep them in mind when participating in any interactions within this project. - -### Our key values - -:material-handshake: Treat the community and the maintainers with respect - -:material-comment-text-multiple: Use welcoming, inclusive, and respectful language - -:material-account-group: Embrace and understand different viewpoints and experiences - -:material-checkbox-multiple-marked-circle: Accept decisions from the maintainers, even if things are not going your way - -:material-heart-multiple: Focus on what's best for the community and show empathy towards other community members - ---- + [Code of Conduct]: https://github.com/squidfunk/mkdocs-material/blob/master/CODE_OF_CONDUCT.md + [reaction]: https://github.blog/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/ ## Rights and responsibilities -As maintainers, we reserve the right and have the responsibility to close, -remove, reject, or edit contributions, such as issues, comments, or commits, -that do not align with our contribution guidelines and our [Code of Conduct]. +As maintainers, we reserve the right and have the responsibility to close, +remove, reject, or edit contributions, such as issues, discussions, comments, +or commits, that do not align with our contribution guidelines and our +[Code of Conduct]. ### Incomplete issues -We have invested significant time in reviewing our contribution process and -carefully assessed the information that is crucial to us when reviewing and -responding to issues. Each field in our issue templates has been thoughtfully -curated, requesting only the necessary information to understand your report or -request. Therefore, it is mandatory for you to fill out every field as requested -to the best of your knowledge without questioning the issue template. Trust us, -we need this information because it ensures that every user and project -maintainer, regardless of experience, can understand the content and severity of -your report or request. +We have invested significant time in reviewing our contribution process and +carefully assessed the essential requirements when reviewing and responding to +issues. Each field in our issue templates has been thoughtfully curated, helping +us to understand your matter. -> __Please note that we reserve the right to close issues__ missing essential -> information, such as minimal reproductions, or that do not comply with -> the quality standards and requirements stated in the issue template. Issues -> can be reopened once the missing information has been provided. +__Therefore, it is mandatory to fill out every field as requested__ to the best +of your knowledge. We need all of this information because it ensures that every +user and maintainer, regardless of their experience, can understand the content +and severity of your bug report or change request. +__We reserve the right to close issues missing essential information__, such as +but not limited to [minimal reproductions], or that do not comply with the +quality standards and requirements stated in our issue templates. Issues +can be reopened once the missing information has been provided. -### CoC violations + [minimal reproductions]: ../guides/creating-a-reproduction.md -As stated in our [Code of Conduct], we expect all members of our community to -treat each other with respect and use inclusive and welcoming language. We -strive to create a positive and supportive environment and consider any -inappropriate, threatening, offensive, or harmful behavior violating our Code of -Conduct. We take such violations seriously and will take appropriate action in -response. +### Code of Conduct -> __Please note__ that we __reserve the right and have the responsibility to remove, edit, or reject any contributions__, -> including comments, commits, and issues, that violate our Code of Conduct. We -> may also temporarily or permanently ban users found to be violating of the CoC -> from contributing to or interacting in the project. - - [discussion board]: https://github.com/squidfunk/mkdocs-material/discussions - [issue tracker]: https://github.com/squidfunk/mkdocs-material/issues - [documentation]: https://squidfunk.github.io/mkdocs-material/ - [Code of Conduct]: https://github.com/squidfunk/mkdocs-material/blob/master/CODE_OF_CONDUCT.md +As stated in our [Code of Conduct], we expect all members of our community to +treat each other with respect, and use inclusive and welcoming language. We +always strive to create a positive and supportive environment and do not accept +inappropriate, offensive, or harmful behavior. +We take violations seriously and will take appropriate action in response. diff --git a/docs/contributing/reporting-a-bug.md b/docs/contributing/reporting-a-bug.md index b02e40182..5d40218b4 100644 --- a/docs/contributing/reporting-a-bug.md +++ b/docs/contributing/reporting-a-bug.md @@ -1,4 +1,4 @@ -# Bug reporting +# Bug reports Material for MkDocs is an actively maintained project that we constantly strive to improve. With a project of this size and complexity, bugs may occur. If you @@ -9,12 +9,12 @@ public [issue tracker], following this guide. ## Before creating an issue -With more than 20.000 users, issues are created every other day. The maintainers +With more than 20,000 users, issues are created every other day. The maintainers of this project are trying very hard to keep the number of open issues down by fixing bugs as fast as possible. By following this guide, you will know exactly what information we need to help you quickly. -__But first, please try the following things before creating an issue.__ +__But first, please do the following things before creating an issue.__ ### Upgrade to latest version @@ -37,7 +37,7 @@ We can't offer official support for bugs that might hide in your overrides, so make sure to omit the following settings from `mkdocs.yml`: - [`theme.custom_dir`][theme.custom_dir] - - [`theme.hooks`][theme.hooks] + - [`hooks`][hooks] - [`extra_css`][extra_css] - [`extra_javascript`][extra_javascript] @@ -63,7 +63,7 @@ problems.__ [JavaScript]: ../customization.md#additional-javascript [theme extension]: ../customization.md#extending-the-theme [theme.custom_dir]: https://www.mkdocs.org/user-guide/configuration/#custom_dir - [theme.hooks]: https://www.mkdocs.org/user-guide/configuration/#hooks + [hooks]: https://www.mkdocs.org/user-guide/configuration/#hooks [extra_css]: https://www.mkdocs.org/user-guide/configuration/#extra_css [extra_javascript]: https://www.mkdocs.org/user-guide/configuration/#extra_javascript [discussion board]: https://github.com/squidfunk/mkdocs-material/issues @@ -118,8 +118,8 @@ how to create a complete and helpful bug report. ## Issue template -We have created a new issue template to make the bug-reporting process as simple -as possible and more efficient for the community and us. It is the result of +We have created a new issue template to make the bug reporting process as simple +as possible and more efficient for our community and us. It is the result of our experience answering and fixing more than 1,600 issues (and counting) and consists of the following parts: @@ -148,11 +148,11 @@ summary of the issue, so the impact and severity of the bug you want to report can be inferred from the title. | | Example | -| -------- | -------- | +| -------- | -------- | | :material-check:{ style="color: #4DB6AC" } __Clear__ | Built-in `typeset` plugin changes precedence of nav title over `h1` | :material-close:{ style="color: #EF5350" } __Wordy__ | The built-in `typeset` plugin changes the precedence of the nav title over the document headline | :material-close:{ style="color: #EF5350" } __Unclear__ | Title does not work -| :material-close:{ style="color: #EF5350" } __Generic__ | Please help +| :material-close:{ style="color: #EF5350" } __Useless__ | Help ### Context optional { #context } @@ -235,17 +235,17 @@ make it easier for us maintainers to improve the documentation. ### Reproduction A minimal reproduction is at the heart of every well-written bug report, as -it allows us maintainers to quickly recreate the necessary conditions to inspect -the bug and quickly find its root cause. It's a proven fact that issues with -concise and small reproductions can be fixed much faster. +it allows us maintainers to instantly recreate the necessary conditions to +inspect the bug to quickly find its root cause. It's a proven fact that issues +with concise and small reproductions can be fixed much faster. [:material-bug: Create reproduction][Create reproduction]{ .md-button .md-button--primary } --- -After you have created the reproduction, you should have a .zip file, ideally not -larger than 1 MB. Just drag and drop the .zip file into this field, which will -automatically upload it to GitHub. +After you have created the reproduction, you should have a `.zip` file, ideally +not larger than 1 MB. Just drag and drop the `.zip` file into this field, which +will automatically upload it to GitHub. > __Why we need this__: if an issue contains no minimal reproduction or just > a link to a repository with thousands of files, the maintainers would need to @@ -259,21 +259,21 @@ automatically upload it to GitHub. process. The reason is that the reproduction, which is automatically produced by the [built-in info plugin] contains all of the necessary environment information that is often forgotten to be included. - + Additionally, there are many non-technical users of Material for MkDocs that have trouble creating repositories. - [Create reproduction]: reproduction.md - [built-in info plugin]: reproduction.md#creating-a-zip-file + [Create reproduction]: ../guides/creating-a-reproduction.md + [built-in info plugin]: ../plugins/info.md ### Steps to reproduce At this point, you provided us with enough information to understand the bug -and gave us a reproduction that we could run and inspect. However, when we -run your reproduction, it might not be immediately apparent how we can see +and provided us with a reproduction that we could run and inspect. However, when +we run your reproduction, it might not be immediately apparent how we can see the bug in action. -Next, please list the specific steps we should follow when running your +Thus, please list the specific steps we should follow when running your reproduction to observe the bug. Keep the steps short and concise, and make sure not to leave anything out. Use simple language as you would explain it to a five-year-old, and focus on continuity. @@ -287,9 +287,13 @@ five-year-old, and focus on continuity. If you're reporting a bug that only occurs in one or more _specific_ browsers, we need to know which browsers are affected. This field is optional, as it is only relevant when the bug you are reporting does not involve a crash when -[previewing] or [building] your site. Moreover, to verify that a browser -extension is not the source of the bug, test if the issue persists when -switching to incognito mode. +[previewing] or [building] your site. + +--- + +:material-incognito: __Incognito mode__ – Please verify that a the bug is +not caused by a browser extension. Switch to incognito mode and try to reproduce +the bug. If it's gone, it's caused by an extension. > __Why we need this__: some bugs only occur in specific browsers or versions. > Since now, almost all browsers are evergreen, we usually don't need to know the diff --git a/docs/contributing/reporting-a-docs-issue.md b/docs/contributing/reporting-a-docs-issue.md index 985265205..460aadf77 100644 --- a/docs/contributing/reporting-a-docs-issue.md +++ b/docs/contributing/reporting-a-docs-issue.md @@ -1,76 +1,91 @@ -# Documentation issue reporting +# Documentation issues -The documentation for Material for MkDocs is spread across more than 60 pages -and covers information about its features, configurations, and everything you -need to take advantage of Material for MkDocs' full capabilities. If you have -found an inconsistency, an issue, or see room for improvement in the -documentation, please submit an issue to our public [issue tracker] by following -this guide. +Our documentation is composed of more than 80 pages and includes extensive +information on features, configurations, customizations, and much more. If you +have found an inconsistency or see room for improvement, please follow this +guide to submit an issue on our [issue tracker]. [issue tracker]: https://github.com/squidfunk/mkdocs-material/issues -## Documentation issue template +## Issue template -Reporting something in the documentation differs from reporting a bug in the code. -Please thoroughly read the following guide before creating a new documentation -issue. +Reporting a documentation issue is usually less involved than reporting a bug, +as we don't need a [reproduction]. Please thoroughly read this guide before +creating a new documentation issue, and provide the following information as +part of the issue: + +- [Title] +- [Description] +- [Related links] +- [Proposed change] optional +- [Checklist] + + [reproduction]: ../guides/creating-a-reproduction.md + [Title]: #title + [Description]: #description + [Related links]: #related-links + [Proposed change]: #proposed-change + [Checklist]: #checklist ### Title -An excellent documentation issue title should be a short, one-sentence -description of the issue and contain all relevant information and, in particular -keywords – to simplify the search in the issue tracker. +A good title should be a short, one-sentence description of the issue, contain +all relevant information and, in particular, keywords to simplify the search in +our issue tracker. | | Example | -| -------- | -------- | -| :material-check:{ style="color: #4DB6AC" } __Clear__ | wrong feature flag code.action -| :material-close:{ style="color: #EF5350" } __Unclear__ | Missing information -| :material-close:{ style="color: #EF5350" } __Generic__ | Please help +| -------- | -------- | +| :material-check:{ style="color: #4DB6AC" } __Clear__ | Clarify social cards setup on Windows +| :material-close:{ style="color: #EF5350" } __Unclear__ | Missing information in the docs +| :material-close:{ style="color: #EF5350" } __Useless__ | Help ### Description -Provide a clear and concise summary of the inconsistency or issue you -encountered in the documentation or the documentation section that needs -improvement. Explain why you think the documentation should be adjusted and -describe the severity of the issue. +Provide a clear and concise summary of the inconsistency or issue you +encountered in the documentation or the documentation section that needs +improvement. Explain why you think the documentation should be adjusted and +describe the severity of the issue: -- __Keep it short and concise__ – if the inconsistency or issue can be - precisely explained in one or two sentences, perfect. +- __Keep it short and concise__ – if the inconsistency or issue can be + precisely explained in one or two sentences, perfect. Maintainers and future + users will be grateful for having to read less. -- __One issue at a time__ – if you encounter multiple unrelated inconsistencies - or issues on different documentation sites, please create separate issues. - Don't report multiple issues in one issue report, which makes identifying - them difficult. +- __One issue at a time__ – if you encounter several unrelated inconsistencies, + please create separate issues for them. Don't report them in the same issue + – it makes attribution difficult. -> __Why we need this__: for us to understand the issue you have found or the -> clarification of the documentation needs, we ask for a description and -> explanation of the serenity. +> __Why we need this__: describing the problem clearly and concisely is a +> prerequisite for improving our documentation – we need to understand what's +> wrong, so we can fix it. -### Links to the documentation +### Related links -After you described the documentation section that needs to be adjusted above, -we now ask you to share the link to this specific documentation section. Make -sure you link to the sub-pages and anchor the headings directly. +After you described the documentation section that needs to be adjusted above, +we now ask you to share the link to this specific documentation section and +other possibly related sections. Make sure to use anchor links (permanent links) +where possible, as it simplifies discovery. -> __Why we need this__: providing the link to the documentation helps us -> understand which sections of our documentation need to be adjusted, extended, -> or overhauled. +> __Why we need this__: providing the links to the documentation help us +> understand which sections of our documentation need to be adjusted, extended, +> or overhauled. -### Improvement proposals -Now that you have provided us with the description and link to the -documentation, you can help us, maintainers, and the community by proposing an -improvement. This can be a suggestion, a fix, or a temporary workaround. +### Proposed change optional { #proposed-change } -> __Why we need this__: improvement proposal can be beneficial for other users -> who encounter the same issue, since it will offer them a temporary solution -> until we maintainers can update the documentation. +Now that you have provided us with the description and links to the +documentation sections, you can help us, maintainers, and the community by +proposing an improvement. You can sketch out rough ideas or write a concrete +proposal. This field is optional but very helpful. + +> __Why we need this__: an improvement proposal can be beneficial for other +> users who encounter the same issue, as they offer solutions before we +> maintainers can update the documentation. ### Checklist -Thanks for following the documentation issue reporting guide and creating a -high-quality documentation issue report. The checklist ensures that you have read -this guide and have worked to your best knowledge to provide us with every piece -of information we need to improve the Material for MkDocs documentation. +Thanks for following the guide and providing valuable feedback for our +documentation – you are almost done. The checklist ensures that you have read +this guide and have worked to your best knowledge to provide us with every piece +of information we need to improve it. __We'll take it from here.__ diff --git a/docs/contributing/requesting-a-change.md b/docs/contributing/requesting-a-change.md index a3a1ab18f..a708ae50d 100644 --- a/docs/contributing/requesting-a-change.md +++ b/docs/contributing/requesting-a-change.md @@ -1,70 +1,78 @@ -# Requesting a change +# Change requests Material for MkDocs is a powerful tool for creating beautiful and functional -project documentation. With more than 20,000 users, we understand that our -project serves a wide range of use cases, which is why we have created the -following guide. +documentation. With more than 20,000 users, we understand that our project +serves a wide range of use cases, which is why we have created the following +guide. --- Put yourself in our shoes – with a project of this size, it can be challenging to maintain existing functionality while constantly adding new features at the same time. We highly value every idea or contribution from our community, and -we kindly ask you to take the time to read the following guidelines before -submitting your change request in our public [issue tracker]. This will help us -better understand the proposed change and how it will benefit the community. +we kindly ask you to take the time to read the following guidelines before +submitting your change request in our public [issue tracker]. This will help us +better understand the proposed change and how it will benefit our community. This guide is our best effort to explain the criteria and reasoning behind our decisions when evaluating change requests and considering them for -implementation. +implementation. [issue tracker]: https://github.com/squidfunk/mkdocs-material/issues ## Before creating an issue -Before you invest your time in filling out and submit a change request, we kindly +Before you invest your time to fill out and submit a change request, we kindly ask you to do some preliminary work by answering some questions to determine if your idea is a good fit for Material for MkDocs and matches the project's [philosophy] and tone. -__Please find answers to the following questions before creating an issue.__ +__Please do the following things before creating an issue.__ [philosophy]: ../philosophy.md ### It's not a bug, it's a feature Change requests are intended to suggest minor adjustments, ideas for new -features, or to influence the project's direction and vision. It is important -to note that change requests are not intended for reporting bugs, as they're -missing essential information for debugging. +features, or to kindly influence the project's direction and vision. It is +important to note that change requests are not intended for reporting bugs, as +they're missing essential information for debugging. If you want to report a bug, please refer to our [bug reporting guide] instead. [bug reporting guide]: reporting-a-bug.md -### Source of inspiration +### Look for sources of inspiration If you have seen your idea implemented in another static site generator or theme, make sure to collect enough information on its implementation before submitting, as this allows us to evaluate potential fit more quickly. Explain what you like and dislike about the implementation. -### Benefit for the community +### Connect with our community -Our [discussion board] is the best place to connect with our community. When -evaluating new ideas, it's essential to seek input from other users and consider +Our [discussion board] is the best place to connect with our community. When +evaluating new ideas, it's essential to seek input from other users and consider alternative viewpoints. This approach helps to implement new features in a way that benefits a large number of users. -[:octicons-comment-discussion-16:  Start a discussion][Start a discussion]{ .md-button .md-button--primary } +__Keep track of all search terms and relevant links, you'll need +them in the change request.__[^1] - [Start a discussion]: https://github.com/squidfunk/mkdocs-material/discussions + [^1]: + We might be using terminology in our documentation different from yours, + but we mean the same. When you include the search terms and related links + in your change request, you help us to adjust and improve the documentation. + +[:octicons-comment-discussion-16:  Start a discussion][discussion board]{ .md-button .md-button--primary } + + [discussion board]: https://github.com/squidfunk/mkdocs-material/discussions ## Issue template -Now that you have taken the time to do the necessary preliminary work and ensure +Now that you have taken the time to do the necessary preliminary work and ensure that your idea meets our requirements, you are invited to create a change -request. The following guide will walk you through all the necessary steps to +request. The following guide will walk you through all the necessary steps to help you submit a comprehensive and useful issue: - [Title] @@ -86,15 +94,15 @@ help you submit a comprehensive and useful issue: ### Title A good title is short and descriptive. It should be a one-sentence executive -summary of the idea, so the potential impact and benefit for the community can +summary of the idea, so the potential impact and benefit for our community can be inferred from the title. | | Example | -| -------- | -------- | +| -------- | -------- | | :material-check:{ style="color: #4DB6AC" } __Clear__ | Index custom front matter in search | :material-close:{ style="color: #EF5350" } __Wordy__ | Add a feature where authors can define custom front matter to be indexed in search | :material-close:{ style="color: #EF5350" } __Unclear__ | Improve search -| :material-close:{ style="color: #EF5350" } __Generic__ | Please help +| :material-close:{ style="color: #EF5350" } __Useless__ | Help ### Context optional { #context } @@ -110,19 +118,26 @@ relevant. Don't write about the change request here. ### Description -Next, provide a detailed and clear description of your idea. Explain why your +Next, provide a detailed and clear description of your idea. Explain why your idea is relevant to Material for MkDocs and must be implemented here and not -in one of its dependencies: +in one of its dependencies:[^2] + + [^2]: + Sometimes, users suggest ideas on our [issue tracker] that concern one of + our upstream dependencies, including [MkDocs][mkdocs], [Python Markdown], + [Python Markdown Extensions] or third-party plugins. It's a good idea to + think about whether your idea is beneficial to other themes, upstreaming + change requests for a bigger impact. - __Explain the what, not the why__ – don't explain [the benefits of your idea][Use cases] here, we're getting there. Focus on describing the proposed change request as precisely as possible. -- __Keep it short and concise__ – be brief and to the point when describing +- __Keep it short and concise__ – be brief and to the point when describing your idea, there is no need to over-describe it. Maintainers and future users will be grateful for having to read less. -- __One idea at a time__ – if you have multiple ideas that don't belong +- __One idea at a time__ – if you have multiple ideas that don't belong together, please open separate change requests for each of those ideas. --- @@ -132,21 +147,24 @@ way to add the proposed change, you can help other users by sharing it here before we maintainers can add it to our code base. > __Why we need this__: To understand and evaluate your proposed change, we -> need to have a clear understanding of your idea. By providing a detailed and +> need to have a clear understanding of your idea. By providing a detailed and > precise description, you can help save you and us time spent discussing > further clarification of your idea in the comments. + [Python Markdown]: https://python-markdown.github.io/extensions/ + [Python Markdown Extensions]: https://facelessuser.github.io/pymdown-extensions/ + ### Related links -Please provide any relevant links to issues, discussions, or documentation +Please provide any relevant links to issues, discussions, or documentation sections related to your change request. If you (or someone else) already -discussed this idea with the community on our discussion board, please include +discussed this idea with our community on our discussion board, please include the link to the discussion as well. > __Why we need this__: Related links help us gain a comprehensive > understanding of your change request by providing additional context. > Additionally, linking to previous issues and discussions allows us -> to quickly evaluate the feedback and input already provided by the community. +> to quickly evaluate the feedback and input already provided by our community. ### Use cases @@ -155,95 +173,69 @@ perspective – what's the expected impact, and why does it not only benefit you but other users? How many of them? Furthermore, would it potentially break existing functionality? -> __Why we need this__: Understanding the use cases and benefits of an idea is -> crucial in evaluating its potential impact and usefulness for the project and -> its users. This information helps us to understand the expected value of the +> __Why we need this__: Understanding the use cases and benefits of an idea is +> crucial in evaluating its potential impact and usefulness for the project and +> its users. This information helps us to understand the expected value of the > idea and how it aligns with the goals of the project. ### Visuals optional { #visuals } -We now have a clear and detailed description of your idea, including information -on its potential use cases and relevant links for context. If you have any -visuals, such as sketches, screenshots, mockups, or external assets, you may +We now have a clear and detailed description of your idea, including information +on its potential use cases and relevant links for context. If you have any +visuals, such as sketches, screenshots, mockups, or external assets, you may present them in this section. __You can drag and drop the files here or include links to external assets.__ -Additionally, if you have seen this change, feature, or improvement used in -other static site generators or themes, please provide an example by showcasing +Additionally, if you have seen this change, feature, or improvement used in +other static site generators or themes, please provide an example by showcasing it and describing how it was implemented and incorporated. -> __Why we need this__: Illustrations and visuals can help us maintainers -> better understand and envision your idea. Screenshots, sketches, or mockups -> can create an additional level of detail and clarity that text alone may not -> be able to convey. Also, seeing how your idea has been implemented in other -> projects can help us understand its potential impact and feasibility in -> Material for MkDocs, which helps us maintainers evaluate and triage -> change requests. +> __Why this might be helpful__: Illustrations and visuals can help us +> maintainers better understand and envision your idea. Screenshots, sketches, +> or mockups can create an additional level of detail and clarity that text +> alone may not be able to convey. Also, seeing how your idea has been +> implemented in other projects can help us understand its potential impact and +> feasibility in Material for MkDocs, which helps us maintainers evaluate and +> triage change requests. ### Checklist -Thanks for following the change request guide and creating a high-quality -change request. The checklist ensures that you have read this guide and have -worked to your best knowledge to provide us with every piece of information to +Thanks for following the guide and creating a high-quality change request – you +are almost done. The checklist ensures that you have read this guide and have +worked to your best knowledge to provide us with every piece of information to review your idea for Material for MkDocs. __We'll take it from here.__ --- -## Your change request was rejected? +## Rejected requests -We're sorry that your change request didn't make the cut. We understand it can -be frustrating when your ideas don't get accepted. We want you to know that as -project maintainers, we have to weigh the community's needs as a whole, and -sometimes that means making tough decisions. We always try to consider many -factors when evaluating change requests, and we'll explain the reasoning behind -our decisions whenever we can. If you're unsure why your request was turned -down, please ask for clarification. +__Your change request got rejected? We're sorry for that.__ We understand it can +be frustrating when your ideas don't get accepted, but as the maintainers of a +very popular project, we always need to consider the needs of our entire +community, sometimes forcing us to make tough decisions. -### Common reasons +We always have to consider and balance many factors when evaluating change +requests, and we explain the reasoning behind our decisions whenever we can. +If you're unsure why your change request was rejected, please don't hesitate +to ask for clarification. -To provide you with some insight as to why your idea may have been rejected, -it's possible that it didn't align with the project's goals and direction or -the available resources. Here are a few common reasons for rejections: +The following principles (in no particular order) form the basis for our +decisions: -> __Your idea may not...__ +- [ ] Alignment with vision and tone of the project +- [ ] Compatibility with existing features and plugins +- [ ] Compatibility with all screen sizes and browsers +- [ ] Effort of implementation and maintenance +- [ ] Usefulness to the majority of users +- [ ] Simplicity and ease of use +- [ ] Accessibility -> - match the overall tone or vision of this project -> - be compatible with existing features, themes, or plugins -> - be useful to the majority of users -> - be user-friendly for authors -> - be implemented in an accessible way -> - be implemented with reasonable effort -> - be implemented using the [principle of progressive enhancement] -> - be implemented to work on all screen sizes -> - be implemented to work on all modern browsers +But that's not the end of your idea – you can always implement it on your own +via [customization]. If you're unsure about how to do that or want to know if +someone has already done it, feel free to get in touch with our community on +the [discussion board]. - -We highly value and appreciate every idea and contribution you bring to the -table, and we encourage you to keep sharing them with us. Some of these ideas -might even be implemented by us! However, we want to remind you that you also -have the power to implement your ideas on your own by customizing the theme. If -you're unsure about how to realize your ideas or want to know if someone has -already found a solution, feel free to visit our [discussion board] - it's the -perfect place for you! - - [discussion board]: https://github.com/squidfunk/mkdocs-material/discussions - [principle of progressive enhancement]: https://developer.mozilla.org/en-US/docs/Glossary/Progressive_Enhancement?retiredLocale=de - -### Dependencies - -Occasionally, users propose ideas on our [issue tracker] that concern one of our -upstream [dependencies], such as [MkDocs], [Python Markdown], -[Python Markdown Extensions] or third-party plugins. In such cases, it's -worthwhile to consider whether your idea could benefit other themes as well. If -so, you might want to consider submitting a change request upstream to have a -greater impact. - - [dependencies]: https://squidfunk.github.io/mkdocs-material/setup/dependencies/image-processing/ - [MkDocs]: https://www.mkdocs.org - [Python Markdown]: https://python-markdown.github.io/extensions/ - [Python Markdown Extensions]: https://facelessuser.github.io/pymdown-extensions/ - [theme.name]: https://www.mkdocs.org/user-guide/configuration/#theme - [dependencies]: #dependencies + [customization]: ../customization.md diff --git a/docs/conventions.md b/docs/conventions.md new file mode 100644 index 000000000..57c02b509 --- /dev/null +++ b/docs/conventions.md @@ -0,0 +1,93 @@ +# Conventions + +This section explains several conventions used in this documentation. + +## Symbols + +This documentation use some symbols for illustration purposes. Before you read +on, please make sure you've made yourself familiar with the following list of +conventions: + +### – Sponsors only { data-toc-label="Sponsors only" } + +The pumping heart symbol denotes that a specific feature or behavior is only +available to sponsors via [Insiders]. Make sure that you have access to +[Insiders] if you want to use the feature. + +### – Version { data-toc-label="Version" } + +The tag symbol in conjunction with a version number denotes when a specific +feature or behavior was added. Make sure you're at least on this version +if you want to use it. + +### – Version (Insiders) { data-toc-label="Version (Insiders)" } + +The tag symbol with a heart in conjunction with a version number denotes that a +specific feature or behavior was added to the [Insiders] version of Material for +MkDocs. + +### – Default value { #default data-toc-label="Default value" } + +Some properties in `mkdocs.yml` have default values for when the author does not +explicitly define them. The default value of the property is always included. + +#### – Default value is computed { #default data-toc-label="is computed" } + +Some default values are not set to static values but computed form other values, +like the site language, repository provider, or other settings. + +#### – Default value is empty { #default data-toc-label="is empty" } + +Some properties do not contain default values. This means that the functionality +that is associated with them is not available unless explicitly enabled. + +### – Metadata property { #metadata data-toc-label="Metadata property" } + +This symbol denotes that the thing described is a metadata property, which can +be used in Markdown documents as part of the front matter definition. + +### – Multiple instances { #multiple-instances data-toc-label="Multiple instances" } + +This symbol denotes that the plugin supports multiple instances, i.e, that it +can be used multiple times in the `plugins` setting in `mkdocs.yml`. + +### – Optional feature { #feature data-toc-label="Optional feature" } + +Most of the features are hidden behind feature flags, which means they must +be explicitly enabled via `mkdocs.yml`. This allows for the existence of +potentially orthogonal features. + +### – Experimental { data-toc-label="Experimental" } + +Some newer features are still considered experimental, which means the ymight +(although rarely) change at any time, including their complete removal (which +hasn't happened yet). + +### – Plugin { data-toc-label="Plugin" } + +Several features are implemented through MkDocs excellent plugin architecture, +some of which are built-in and distributed with Material for MkDocs, so no +installation is required. + +### – Markdown extension { data-toc-label="Markdown extension" } + +This symbol denotes that the thing described is a Markdown extension, which can +be enabled in `mkdocs.yml` and adds additional functionality to the Markdown +parser. + +### – Required value { #required data-toc-label="Required value" } + +Some (very few in fact) properties or settings are required, which means the +authors must explicitly define them. + +### – Customization { #customization data-toc-label="Customization" } + +This symbol denotes that the thing described is a customization that must be +added by the author. + +### – Utility { data-toc-label="Utility" } + +Besides plugins, there are some utilities that build on top of MkDocs in order +to provide extended functionality, like for example support for versioning. + + [Insiders]: insiders/index.md diff --git a/docs/creating-your-site.md b/docs/creating-your-site.md index 0a9d14138..dd6d6fee9 100644 --- a/docs/creating-your-site.md +++ b/docs/creating-your-site.md @@ -1,6 +1,6 @@ # Creating your site -After you've [installed] 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 your project to be located and enter: @@ -48,7 +48,7 @@ theme: ???+ tip "Recommended: [configuration validation and auto-complete]" - In order to minimize friction and maximize productivity, Material for MkDocs + In order to minimize friction and maximize productivity, Material for MkDocs provides its own [schema.json][^1] for `mkdocs.yml`. If your editor supports YAML schema validation, it's definitely recommended to set it up: diff --git a/docs/customization.md b/docs/customization.md index 720889dfa..d806d3682 100644 --- a/docs/customization.md +++ b/docs/customization.md @@ -100,6 +100,7 @@ assets may also be put in the `overrides` directory: │ │ └─ analytics.html # Analytics setup │ ├─ languages/ # Translation languages │ ├─ actions.html # Actions +│ ├─ alternate.html # Site language selector │ ├─ comments.html # Comment system (empty by default) │ ├─ consent.html # Consent │ ├─ content.html # Page content @@ -113,6 +114,7 @@ assets may also be put in the `overrides` directory: │ ├─ nav.html # Main navigation │ ├─ nav-item.html # Main navigation item │ ├─ pagination.html # Pagination (used for blog) +│ ├─ palette.html # Color palette toggle │ ├─ post.html # Blog post excerpt │ ├─ search.html # Search interface │ ├─ social.html # Social links @@ -223,7 +225,7 @@ to make more fundamental changes, it may be necessary to make the adjustments directly in the source of the theme and recompile it. [^1]: - Prior to :octicons-tag-24: 7.0.0 the build was based on Webpack, resulting + Prior to the build was based on Webpack, resulting in occasional broken builds due to incompatibilities with loaders and plugins. Therefore, we decided to swap Webpack for a leaner solution which is now based on [RxJS] as the application itself. This allowed for the @@ -235,20 +237,38 @@ directly in the source of the theme and recompile it. ### Environment setup -In order to start development on Material for MkDocs, a [Node.js] version of -at least 14 is required. First, clone the repository: +First, clone the repository: ``` git clone https://github.com/squidfunk/mkdocs-material -``` - -Next, all dependencies need to be installed, which is done with: - -``` cd mkdocs-material +``` + +Next, create a new [Python virtual environment][venv] and +[activate][venv-activate] it: + +``` +python -m venv venv +source venv/bin/activate +``` + + [venv]: https://docs.python.org/3/library/venv.html + [venv-activate]: https://docs.python.org/3/library/venv.html#how-venvs-work + +Then, install all Python dependencies: + +``` pip install -e . pip install mkdocs-minify-plugin pip install mkdocs-redirects +pip install nodeenv +``` + +Finally, install the [Node.js] LTS version into the Python virtual environment +and install all Node.js dependencies: + +``` +nodeenv -p -n lts npm install ``` @@ -290,7 +310,7 @@ npm run build # (1)! 1. While this command will build all theme files, it will skip the overrides used in Material for MkDocs' own documentation which are not distributed with the theme. If you forked the theme and want to build the overrides - as well, use: + as well, e.g. before submitting a PR with changes, use: ``` npm run build:all diff --git a/docs/enterprise-support.md b/docs/enterprise-support.md new file mode 100644 index 000000000..af1f40984 --- /dev/null +++ b/docs/enterprise-support.md @@ -0,0 +1,5 @@ +--- +template: redirect.html +location: https://calendly.com/squidfunk/enterprise +status: new +--- diff --git a/docs/faq/sponsoring.md b/docs/faq/sponsoring.md new file mode 100644 index 000000000..9f90139dd --- /dev/null +++ b/docs/faq/sponsoring.md @@ -0,0 +1,481 @@ +# Sponsoring FAQs + +Do you have questions about Material for MkDocs Insiders? We do our best to +answer all of your questions on this page. If you can't find your question +below, ask it on our [discussion board]! + + [discussion board]: https://github.com/squidfunk/mkdocs-material/discussions/new/chooses + +## General + +[__Why is the Insiders edition offered as a subscription model?__](#insiders-subscription){ #insiders-subscription } + +Material for MkDocs always was and will be Open Source, available for free to +individuals and organizations. As the project grew over time, we found that +maintaining and managing the overhead that comes with growth became more +challenging and time-consuming. + +In order to sustain the project and add new and useful features more frequently, +we decided to create the [Insiders] edition, with early access to the latest and +greatest features of Material for MkDocs. The subscription-based model of the +Insiders edition allows us to dedicate more time and resources to the project, +which benefits all +users of Material for MkDocs. Once our funding goals based on monthly +subscriptions are hit, the Insiders features of those^ funding goals are released +to the community edition, letting everyone benefit from them. + +Maintaining both the community and Insiders editions is an ongoing process, and +we rely on our sponsors to support us on a monthly basis, which makes this whole +project possible. + +[__What features are included in the Insiders edition?__](#insiders-features){ #insiders-features } + +The Insiders edition includes more than 20 additional features. You can find an +overview of these features on our [Insiders page], which is updated when new +features are added and released. + + [Insiders]: ../insiders/index.md + [Insiders page]: ../insiders/index.md#whats-in-it-for-me + +[__How often is the Insiders edition updated?__](#insiders-updates){ #insiders-updates } + +We try to keep our open issue count low, fixing known bugs quickly. Both our +repositories, the community and Insiders edition, are constantly updated with +bug fixes and new features. + +## Sponsorship + +[__Can I sponsor the project without a GitHub account?__](#sponsorship-account){ #sponsorship-account } + +Yes. You can support Material for MkDocs by sponsoring us on [Ko-fi], regardless +of whether you have a GitHub account or not. However, please note that Insiders +is provided as a private repository on GitHub. If after sponsoring, you'd like to +gain access to the repository, you'll need to have a GitHub individual or bot +account that can be added as a collaborator. If your organization doesn't use +GitHub or/and host its repositories on other platforms, you can mirror the +Insiders repository in your environment once you have access. + +[__Which sponsoring tier should I choose?__](#sponsorship-tier){ #sponsorship-tier } + +The sponsoring tiers are divided into non-commercial and commercial tiers. If +you are an individual or organization using Material for MkDocs for private or +__non-commercial__ Open Source projects, you have two tiers to choose from, +depending on the number of sites you want to build. For companies using +Material for MkDocs, we offer three different __commercial__ tiers, from which +you can choose depending on your requirements. + +Also, please read what is considered [commercial use]. + + [commercial use]: #commercial-use + +[__Why are one-time sponsorships not granted access to Insiders?__](#sponsorship-one-time){ #sponsorship-one-time } + +Primarily due to technical reasons, that we're working on lifting in the future. +We use GitHub webhooks to determine our current active sponsors. When you create +or cancel your monthly subscription, GitHub sends events that we use to +automatically add and remove collaborators. + +Note that [$15] is the minimum amount to be granted access to Insiders. + + [$15]: https://github.com/sponsors/squidfunk/sponsorships?tier_id=210638 + +[__How are sponsorship contributions used?__](#sponsorship-support){ #sponsorship-support } + +It's vital to recognize that the total sponsorship amount doesn't directly +translate into the funds we have available for use. The way we allocate +sponsorship amounts is detailed as follows: + +1. __Taxes__: Since we provide a service to our sponsors, we're of course + legally obligated to pay sales tax. This requirement applies to all + sponsorship contributions, aligning us with standard business practices + as for the rest of the world. + +2. __Sponsorships__: A significant portion of our funding is redirected to + upstream projects. This cultivates collaboration and supports the broader + Open Source ecosystem. Those projects and their maintainers are essential + for the ongoing development of Material for MkDocs. + + [Explore our sponsorships](https://github.com/squidfunk?tab=sponsoring). + +3. __Funds__: We are in the process of forming a team devoted to Material for + MkDocs and are proactively compensating critical contributors. These + funds cover various aspects of the project, like the creation of new + features, bug resolution, support, and sponsor relations. + +[__Are there any limitations on the number of sponsors for a particular tier?__](#sponsorship-limitations){ #sponsorship-limitations } + +No, there are no limitations on the number of sponsors for any tier. You can +sponsor the project at any tier regardless of how many other sponsors are +already there. + +## Payment & billing + +[__Is there a trial period for the Insiders edition?__](#insiders-trial){ #insiders-trial } + +No, we do not offer a trial period for the Insiders edition. However, if you're +a company and are considering sponsoring on the commercial tier, but want to +first give the Insiders edition a try, you can sponsor on the [$15] tier with a +personal account for non-commercial evaluation purposes. + +Additionally, our subscription model allows you to cancel your sponsorship +anytime. If you decide to cancel, your sponsorship will remain active until +the end of your billing cycle. + +[__What payment options do you accept?__](#insiders-payment){ #insiders-payment } + +We manage all our transactions and sponsorships through [GitHub Sponsors] and +[Ko-fi]. To become a sponsor of Material for MkDocs on GitHub, visit +[our sponsors' page]. On there, you can choose from five different sponsorship +tiers and pay by credit card. Please note that as of the beginning of 2023, +[GitHub no longer supports PayPal] payments. If you wish to pay with PayPal, +you can find a selection of our sponsorship tiers on [Ko-fi]. Both platforms +provide you with a payment receipt once your purchase is successful. + +If you're a company and need assistance choosing the right payment method, +please don't hesitate to reach out to sponsors@squidfunk.com. + + [Ko-fi]: https://ko-fi.com/squidfunk + [GitHub Sponsors]: https://github.com/sponsors + [GitHub no longer supports PayPal]: https://github.blog/changelog/2023-01-23-github-sponsors-will-stop-supporting-paypal/ + [our sponsors' page]: https://github.com/sponsors/squidfunk/ + +[__Are discounts available for the Insiders edition, such as student discounts?__](#insiders-discounts){ #insiders-discounts } + +Unfortunately, we are not able to offer any discounts for the Material for +MkDocs Insiders program. To ensure that everyone can afford the Insiders program +and keep the barrier as low as possible, we have set prices as low as [$15] a +month for non-commercial use. + +[__Do you offer free access to Insiders for Open Source projects?__](#insiders-open-source){ #insiders-open-source } + +No, we do not offer free access to our Material for MkDocs Insiders edition. +We understand that non-profit organizations may have limited budgets and may +need to prioritize their spending on other projects or organizations. However, +it's important to note that Material for MkDocs is maintained by a small team, +investing a lot of time and resources into constantly improving this project. +Material for MkDocs and its core features are free to the community through our +Open Source model. Therefore, Material for MkDocs itself is already free. + +However, we do offer an affordable sponsorship tier starting at [$15] a month, +which is meant for individuals and non-profit organizations using Material for +MkDocs to build 1-2 sites for non-commercial purposes. This tier provides access +to all new features, benefiting you from our ongoing development efforts. + +[__Is Insiders free for those who contribute to this project?__](#insiders-contributors){ #insiders-contributors } + +Great question! We can not offer free access to "drive-by" contributors that +only fix minor issues like typos or add new languages. These contributions are +always welcome, but as we need to review them, they result in a higher time +investment from our side and don't compensate for this work. However, as this +project keeps growing, we always seek for individuals to support us. In return, +we offer financial compensation or/and Insiders access. If you are interested +and have experience in the technologies and paradigms listed below, please get +in touch with us at sponsors@squidfunk.com: + +- Deep knowledge of CSS, HTML, TypeScript +- Experience with progressive enhancement and responsive design +- Experience with reactive programming with RxJS +- Solid understanding of Python, MkDocs + ecosystem +- Solid technical writing skills + +Additionally, we're working on a contributor program that will reward +contributors that engage in the community by answering questions and helping +users with access to Insiders. + +[__How can I set my billing to monthly or yearly?__](#insiders-billing-cycle){ #insiders-billing-cycle } + +You can sponsor Material for MkDocs on a monthly or yearly basis. Depending on +your billing cycle you automatically become a monthly or yearly sponsor. Your +[billing cycle] is an account-level setting that you can easily change in your +account. If, for some reason, you cannot make this change, you can create a +dedicated bot account with a yearly billing cycle on GitHub, which you only use +for sponsoring (some sponsors already do that). If you have any problems or +further questions, please contact us at sponsors@squidfunk.com. + + [billing cycle]: https://docs.github.com/en/github/setting-up-and-managing-billing-and-payments-on-github/changing-the-duration-of-your-billing-cycle + +[__Can I get an invoice for my sponsorship payment?__](#insiders-invoice){ #insiders-invoice} + +Right now, we can't provide you with an invoice for your sponsoring transaction, +as [GitHub Sponsors] handles all transactions for us. However, both payment +platforms, [GitHub] and [Ko-Fi], automatically send you a payment receipt +via mail once the sponsorship is active. + +Furthermore, we are working on a solution to optimize access management and more +features. If you are interested in this, please get in touch with us via mail at +sponsors@squidfunk.com or turn on all notifications for MkDocs, and we will +reach out as soon as we are live. + + [GitHub]: https://github.com/sponsors/squidfunk/ + +[__Can I switch between different sponsoring tiers?__](#insiders-switch-tiers){ #insiders-switch-tiers } + +Yes, you can switch between different sponsoring tiers at any time. Simply go +to the [GitHub Sponsors] page and change your sponsoring tier. Once you make +that change, you will immediately change to the new tier. + +If you change to a higher tier, the amount will be prorated according to your +billing cycle. + +[__Can I sponsor the project for a specific feature or development goal?__](#insiders-goals){ #insiders-goals } + +While sponsoring specific goals directly is not possible, our sponsoring goals +are connected to specific features or development goals aligned with the +project's roadmap. You can find an [overview of these sponsoring goals] and their +associated features on our website. Insider users have early access to all +already developed features, including those associated with higher funding goals +that will be reached at a later stage. If you're interested in accessing these +features, becoming a sponsor is the way to go. If you have a feature in mind +that you would like to see on the list, we encourage you to +[initiate a new discussion] to evaluate it with others. + + [overview of these sponsoring goals]: ../insiders/index.md#goals + [initiate a new discussion]: https://github.com/squidfunk/mkdocs-material/discussions/new/chooses + +[__What happens if I reach my sponsoring limit for my current tier?__](#insiders-limit){ #insiders-limit } + +If you extend the number of sites that are in your current sponsoring limit, +please [upgrade your sponsorship] to a higher tier to continue using the +Insiders version and build more sites. The change will be effective immediately. + + [upgrade your sponsorship]: https://docs.github.com/en/billing/managing-billing-for-github-sponsors/upgrading-a-sponsorship + +[__Do you offer refunds for sponsoring payments?__](#insiders-refunds){ #insiders-refunds } + +Unfortunately, we cannot offer any refund for sponsorship payments. +[GitHub Sponsors] and [Ko-Fi] manage all sponsoring transactions. Because of +that, we do not have any insights into the details of the funds and cannot access +them. If you have any payment issues, please get in touch with the GitHub +or Ko-Fi support team, as they can help you. + +## Access management + +[__How do I gain access to the private Insiders repository?__](#access-account){ #access-account } + +If you sponsored with your __individual account__, you should have received an +email invitation to the private Material for MkDocs Insiders repository right +after you initiated your sponsorship. Simply accept the invitation within seven +days to gain access. + +If you sponsored using an __organization account__, please note we need +an individual account that we can list as a collaborator of the private Insiders +repository. After you initiate your sponsorship, please email us at +sponsors@squidfunk.com with the name of the individual or bot account. Once you +provide us with this information, we will add the account as a collaborator, and +after you accept the invitation, you will gain access to the repository. + +If you have yet to receive the email or the invitation link has expired, please +contact us, the maintainers, at sponsors@squidfunk.com. We're working on a +solution that will allow you to manage collaborator status yourself. + +[__Why can't our whole organization get access to Insiders?__](#access-organization){ #access-organization } + +Currently, it is not possible to grant access to an organizational account, as +GitHub only allows for adding individual user accounts. We are working on a +solution ourselves to simplify access for organizations. For now, to ensure that +access is not tied to a particular individual, we recommend creating a bot +account, i.e., a GitHub account that does not belong to a specific individual +but is listed as the owner of the organizational account and using this account +for sponsorship. + +[__Do I need to fork the repository to use it?__](#access-fork){ #access-fork } + +It depends. If you are using the Insiders edition as an individual, you can work +directly with the private repository, as you do not need to share the Insiders +features with others. If you are working with a team, it is best to create a +private fork using the individual account you listed as a collaborator of +Material for MkDocs to grant access to all members of your organization to +your fork. + +[__Can I share my Insiders access with others?__](#access-share){ #access-share } + +At the moment, it is not possible to directly share your collaborator status +for the private Insiders repository with other accounts. However, if you are +working with a team and would like them to access Insiders, you can share the +Insiders repository by utilizing options such as [cloning], [forking], or +[mirroring]. By doing so, you can start collaborating with your team members on +the new repository you have shared. This way, you can collectively benefit +from the Insiders features and work together on the project. + + [cloning]: https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository + [forking]: https://docs.github.com/en/get-started/quickstart/fork-a-repo + [mirroring]: https://docs.github.com/en/repositories/creating-and-managing-repositories/duplicating-a-repository + + +## Runtime & cancellation + +[__How long is my sponsorship valid?__](#sponsorship-runtime){ #sponsorship-runtime } + +Your sponsorship is valid for as long as your monthly or yearly subscription +is valid. If you choose to cancel your sponsorship, you will lose access to +the Insiders edition once your cancelation is active and will be automatically +removed by GitHub as a collaborator from the private repository. + +[__How do I cancel my sponsorship?__](#sponsorship-cancellation){ #sponsorship-cancellation } + +To cancel your sponsorship, follow the [step-by-step guide] provided by GitHub. +If you sponsored using an organizational account, please ensure that you cancel +your sponsorship using the same organizational account rather than your +individual account. + + [step-by-step guide]: https://docs.github.com/en/billing/managing-billing-for-github-sponsors/downgrading-a-sponsorship + +[__What happens when I cancel my sponsorship?__](#sponsorship-cancellation-effective){ #sponsorship-cancellation-effective } + +If you choose to cancel your subscription to Insiders, you will be +automatically removed by GitHub as a collaborator on the day your cancellation is +effective. From that day on, you will no longer receive future updates. However, +you are __welcome to continue using the latest version__ that was available to +you at the time of your cancellation for as long as you like. + +Please note that [GitHub deletes private forks], so you may want to take steps to ensure +that you have a backup of the software if necessary and use the locally installed version. + + [GitHub deletes private forks]: https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-personal-account-on-github/managing-access-to-your-personal-repositories/removing-a-collaborator-from-a-personal-repository#deleting-forks-of-private-repositories + +## Licensing + +[__What constitutes commercial use of the Insiders version?__](#commercial-use){ #commercial-use } + +Commercial use refers to any use of the software for a business or for-profit +purpose. This includes any use by a corporation or other organization, whether +or not they generate revenue directly from the software. We offer different +pricing tiers for commercial use, each tailored to the needs of different +businesses. It's important to note that internal use of the software within your +organization is also considered commercial use, as with all commercial software. + +[__What constitutes non-commercial use of the Insiders version?__](#non-commercial-use){ #non-commercial-use } + +Non-commercial use of our Material for MkDocs refers to private use. This +includes individuals using the Insiders edition for private or purely +non-commercial Open Source projects. We offer two different tiers for +non-commercial use, depending on the number of sites you want to build. + +[__What is your fair use policy?__](#fair-use-policy){ #fair-use-policy } + +Our fair use policy includes the following guidelines: + +- Please refrain from __distributing the source code__ of Insiders. While you +may use the software for public, private, or commercial projects and may +privately fork or mirror it, we ask that you keep the source code private. This +is important to our sponsorware strategy, which helps us fund ongoing +development and support of the software. If this guidelines is violated, +everybody loses, as it will reduce the time of us maintainers we can set aside +to push this project forward. + +- As our sponsoring tiers are based on the number of sites you want to build, +please make sure to [upgrade your sponsorship] once your current sponsoring tier +limit has been reached. + +[__Does the Insiders version have a different license?__](#insiders-license){ #insiders-license } + +No. Whether you're an individual or a company, you may use Material for +MkDocs Insiders precisely under the same terms as Material for MkDocs, which are +given by the [MIT license]. + +[MIT license]: ../license.md + +[__Can outside collaborators build and run the documentation locally without access to Insiders?__](#insiders-outside-collaborators){ #insiders-outside-collaborators } + +Yes. Insiders is compatible with Material for MkDocs. Almost all new features +and configuration options are either backward-compatible or implemented behind +feature flags. When working with outside collaborators, changing the general +appearance of your site should be optional. Most Insiders features enhance the +overall experience, e.g., by adding icons to pages or providing a feedback +widget. While these features add value for your site's users, they should be +optional for previewing when making changes to content. Currently, the only +content-related feature in Insiders that non-Insiders users can't properly +preview are [Card grids]. + +This means that outside collaborators can build the documentation locally with +Material for MkDocs, and when they push their changes, your CI pipeline will +build it with Insiders. When using built-in plugins exclusive to Insiders, it's +recommended to split configuration into a base `mkdocs.yml` and one with plugin +overrides via [configuration inheritance]. + +See the [getting started guide] for more information. + + [configuration inheritance]: https://www.mkdocs.org/user-guide/configuration/#configuration-inheritance + [getting started guide]: ../insiders/getting-started.md#caveats + [Card grids]: ../reference/grids.md?h=grids#using-card-grids + +## Support + +[__How can I contact support if I have questions about becoming a sponsor?__ ](#support-contact){ #support-contact } + +If you have any questions and would like to contact us before starting your +sponsorship, we are happy to answer all your non-technical questions about the +Insiders program via email at sponsors@squidfunk.com. + +All technical questions should be asked openly on our [discussion board]. + + [discussion board]: https://github.com/squidfunk/mkdocs-material/discussions + +[__Is additional support available for Material for MkDocs Insiders users?__](#support-additional){ #support-additional } + +Yes, we provide non-technical support related to sponsoring at +sponsors@squidfunk.com. For technical questions, please submit an issue openly +on our [issue tracker] or start a discussion on our [discussion board]. Issues +and discussions from our organizational sponsors, sponsoring on +__The Organization__ tier or higher will be prioritized.[^1] + + [^1]: + Priority support means we will prioritize your issue, meaning we will look + into it and do our best to solve your issue asap. However, the prioritized bug + support does not mean that we can solve your issue before any others since + some issues might take more time to solve. + + [issue tracker]: https://github.com/squidfunk/mkdocs-material/issues + +[__How can I display my logo on the list of premium sponsors?__](#sponsorship-logo-placement){ #sponsorship-logo-placement } + +If your sponsorship tier includes logo placement, and you would like us to +display your logo in the [list of premium sponsors] and have it linked to your +site, please contact us via mail. Simply send us a horizontal SVG or PNG version +of your logo making sure it displays the name of your company and the logo to +sponsors@squidfunk.com. + + [list of premium sponsors]: https://github.com/squidfunk/mkdocs-material#user-content-premium-sponsors + +[__Is logo placement optional?__](#sponsorship-logo-placement-optional){ #sponsorship-logo-placement-optional } + +Yes, all of our commercial benefits, such as logo placement and backlinks, are +optional and can be opted in or out at any time. You can keep your sponsorship +completely private. + +[__How can I report a bug in the Insiders version?__](#insiders-bugs){ #insiders-bugs } + +If you encounter a bug in the Insiders edition, we kindly request that you +report it on our [issue tracker] in the public community repository. When +submitting the bug report, please ensure that you do not include any private +Insiders' source code, as we want to uphold our fair use policy. + + +## Privacy + +[__Will you sign an NDA for sponsorships?__](#nda){ #nda } + +Unfortunately, we cannot sign any NDA or vendor agreement form. As a small team +working on Material for MkDocs, we have limited resources and cannot review +and sign agreements. + +[__Can I sponsor privately?__](#sponsorship-private){ #sponsorship-private } + +Yes, you can. GitHub gives you the option to set your sponsorship to [private] +when you set up your sponsorship. Additionally, we have a recommended workflow +for you: We suggest you create a new GitHub bot account. This bot account should +not be tied to a particular individual and should be privately listed as an +owner of your GitHub organization. This account can then be used to sponsor +Material for MkDocs privately. As a bot account, it will automatically be listed +as a collaborator of the private Insiders repository. You can clone, fork, or +mirror using this account. All information will be kept confidential; only the +bot account and us maintainers will have insights into his sponsorship. + + [private]: https://docs.github.com/en/sponsors/sponsoring-open-source-contributors/managing-your-sponsorship#managing-the-privacy-setting-for-your-sponsorship + +[__Are there any geographical restrictions on becoming a sponsor?__](#sponsorship-geo){ #sponsorship-geo } + +No, there are no geographical restrictions for becoming a sponsor. We welcome +sponsorships from individuals and organizations worldwide. As long as your +credit card is valid and accepted by GitHub or Ko-Fi, you are eligible to become +a sponsor and support the project, regardless of your location. diff --git a/docs/getting-started.md b/docs/getting-started.md index 34a49fcdb..0465b5b20 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -1,9 +1,16 @@ # Getting started -Material for MkDocs is a theme for [MkDocs], a static site generator geared -towards (technical) project documentation. If you're familiar with Python, you -can install Material for MkDocs with [`pip`][pip], the Python package manager. -If not, we recommend using [`docker`][docker]. +Material for MkDocs is a powerful documentation framework on top of [MkDocs], +a static site generator for project documentation.[^1] If you're familiar with +Python, you can install Material for MkDocs with [`pip`][pip], the Python +package manager. If not, we recommend using [`docker`][docker]. + + [^1]: + In 2016, Material for MkDocs started out as a simple theme for MkDocs, but + over the course of several years, it's now much more than that – with the + many built-in plugins, settings, and countless customization abilities, + Material for MkDocs is now one of the simplest and most powerful frameworks + for creating documentation for your project. [MkDocs]: https://www.mkdocs.org [pip]: #with-pip @@ -29,7 +36,7 @@ Material for MkDocs with: pip install mkdocs-material=="9.*" # (1)! ``` - 1. Material for MkDocs uses [semantic versioning][^1], which is why it's a + 1. Material for MkDocs uses [semantic versioning][^2], which is why it's a good idea to limit upgrades to the current major version. This will make sure that you don't accidentally [upgrade to the next @@ -47,7 +54,7 @@ Material for MkDocs with: pip install -r requirements.txt ``` - [^1]: + [^2]: Note that improvements of existing features are sometimes released as patch releases, like for example improved rendering of content tabs, as they're not considered to be new features. @@ -61,14 +68,14 @@ install those packages separately. :fontawesome-brands-youtube:{ style="color: #EE0F0F" } __[How to set up Material for MkDocs]__ by @james-willett – :octicons-clock-24: -15m – Learn how to create and host a documentation site using Material for Docs -on GitHub Pages in a step-by-step guide. +15m – Learn how to create and host a documentation site using Material for +MkDocs on GitHub Pages in a step-by-step guide. [How to set up Material for MkDocs]: https://www.youtube.com/watch?v=Q-YA_dA8C20 --- -__Tip__: If you don't have prior experience with Python, we recommend reading +__Tip__: If you don't have prior experience with Python, we recommend reading [Using Python's pip to Manage Your Projects' Dependencies], which is a really good introduction on the mechanics of Python package management and helps you troubleshoot if you run into errors. @@ -100,7 +107,7 @@ and pull the image with: docker pull squidfunk/mkdocs-material:9 ``` -The `mkdocs` executable is provided as an entry point and `serve` is the +The `mkdocs` executable is provided as an entry point and `serve` is the default command. If you're not familiar with Docker don't worry, we have you covered in the following sections. @@ -116,21 +123,38 @@ The following plugins are bundled with the Docker image: ??? question "How to add plugins to the Docker image?" Material for MkDocs only bundles selected plugins in order to keep the size - of the official image small. If the plugin you want to use is not included, - create a new `Dockerfile` and extend the official Docker image: + of the official image small. If the plugin you want to use is not included, + you can add them easily: - ``` Dockerfile - FROM squidfunk/mkdocs-material - RUN pip install ... - ``` + === "Material for MkDocs" - Next, you can build the image with the following command: + Create a `Dockerfile` and extend the official image: + + ``` Dockerfile title="Dockerfile" + FROM squidfunk/mkdocs-material + RUN pip install mkdocs-macros-plugin + RUN pip install mkdocs-glightbox + ``` + + === "Insiders" + + Clone or fork the Insiders repository, and create a file called + `user-requirements.txt` in the root of the repository. Then, add the + plugins that should be installed to the file, e.g.: + + ``` txt title="user-requirements.txt" + mkdocs-macros-plugin + mkdocs-glightbox + ``` + + Next, build the image with the following command: ``` docker build -t squidfunk/mkdocs-material . ``` - The new image can be used exactly like the official image. + The new image will have additional packages installed and can be used + exactly like the official image. ### with git @@ -142,8 +166,7 @@ want to use the very latest version: git clone https://github.com/squidfunk/mkdocs-material.git ``` -The theme will reside in the folder `mkdocs-material/material`. After cloning -from `git`, you must install all required dependencies with: +Next, install the theme and its dependencies with: ``` pip install -e mkdocs-material diff --git a/docs/guides/creating-a-reproduction.md b/docs/guides/creating-a-reproduction.md index 70a183095..d7a4faab9 100644 --- a/docs/guides/creating-a-reproduction.md +++ b/docs/guides/creating-a-reproduction.md @@ -1,8 +1,8 @@ # Creating a reproduction -A reproduction is a simplified version of a bug that demonstrates the specific -scenario in which the bug occurred. It includes all necessary minimal settings -and instructions and should be as simple as possible while still demonstrating +A reproduction is a simplified version of a bug that demonstrates the specific +scenario in which the bug occurred. It includes all necessary minimal settings +and instructions and should be as simple as possible while still demonstrating the issue. ## Guide @@ -22,12 +22,27 @@ just delete and recreate the environment. It's trivial to set up: - Activate the environment with: - ``` sh - . venv/bin/activate # (1)! - ``` + === ":material-apple: macOS" - 1. Your terminal should now print `(venv)` before the prompt, which is - how you know that you are inside an environment. + ``` sh + . venv/bin/activate + ``` + + === ":fontawesome-brands-windows: Windows" + + ``` sh + . venv/Scripts/activate + ``` + + === ":material-linux: Linux" + + ``` sh + . venv/bin/activate + ``` + + + Your terminal should now print `(venv)` before the prompt, which is how you + know that you are inside the virtual environment that you just created. - Exit the environment with: @@ -41,7 +56,7 @@ just delete and recreate the environment. It's trivial to set up: Following the instructions below, you will set up a skeleton project to create a reproduction. As mentioned above, we recommend using a [virtual environment], -so create a new folder in your working directory and a a new virtual environment +so create a new folder in your working directory and a new virtual environment inside it. Next: 1. As mentioned in our [bug reporting guide], ensure that you're running the @@ -72,19 +87,19 @@ inside it. Next: bug, create only the necessary amount of Markdown documents. __Repeat this step until the bug you want to report can be observed.__ -4. As a last step, before packing everything into a .zip file, double-check +4. As a last step, before packing everything into a `.zip` file, double-check all settings and documents if they are essential to the reproduction, which means that the bug does not occur when they are omitted. Remove all non-essential lines and files. [bug reporting guide]: ../contributing/reporting-a-bug.md#upgrade-to-latest-version - [minimal configuration]: ../../creating-your-site/#minimal-configuration + [minimal configuration]: ../creating-your-site.md#minimal-configuration -### Creating a .zip file +### Creating a `.zip` file Material for MkDocs 9.0.0 includes a new plugin solely intended to create reproductions for bug reports. When the built-in info plugin is enabled, MkDocs -will add all relevant files to a .zip, print a summary to the terminal and +will add all relevant files to a `.zip`, print a summary to the terminal and exit. Add the following lines to `mkdocs.yml`: ``` yaml diff --git a/docs/index.md b/docs/index.md index cb9f98f4f..3aea9dfa4 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,6 +1,9 @@ --- template: home.html title: Material for MkDocs +social: + cards_layout_options: + title: Documentation that simply works --- Welcome to Material for MkDocs. diff --git a/docs/insiders/changelog.md b/docs/insiders/changelog.md index 2a66d5813..a7d53c2ca 100644 --- a/docs/insiders/changelog.md +++ b/docs/insiders/changelog.md @@ -2,6 +2,172 @@ ## Material for MkDocs Insiders +### 4.42.0 September 19, 2023 { id="4.42.0" } + +- Added support for using git submodules in projects plugin +- Added support for transforming project configurations +- Improved resilience of optimize and blog plugin +- Fixed optimize plugin crashing on `.jpeg` extension +- Fixed project URLs not using site URLs in projects plugin + +### 4.41.0 September 11, 2023 { id="4.41.0" } + +- Improved multi-instance support for optimize plugin +- Added inclusion and exclusion patterns for optimize plugin +- Added transparent keyword for color handling in social plugin +- Changed default quality of PNGs to 3 in optimize plugin +- Fixed #5979: meta file not detected in root of docs directory + +### 4.40.4 September 4, 2023 { id="4.40.4" } + +- Fixed privacy plugin choking on boolean HTML5 attributes +- Fixed wrapping of inline code blocks in typeset table of contents +- Fixed blog plugin error when running under dirty reload + +### 4.40.3 September 2, 2023 { id="4.40.3" } + +- Fixed #5946: Docker image missing pngquant for optimize plugin + +### 4.40.2 August 31, 2023 { id="4.40.2" } + +- Added configurable error handling capabilities for social plugin +- Fixed #5922: Blog plugin shows no posts when building a standalone blog +- Fixed #5914: Tags plugin tags_extra_files errors (4.39.3 regression) +- Fixed #5904: Blog plugin sometimes excludes files (4.40.1 regression) + +### 4.40.1 August 27, 2023 { id="4.40.1" } + +- Fixed #5902: ResizeObserver polyfill not detected by privacy plugin +- Fixed empty category pages in blog plugin (4.40.0 regression) + +### 4.40.0 August 26, 2023 { id="4.40.0" } + +- Added logo, title and description options to social plugin default layouts +- Fixed privacy plugin compatibility issue with Python < 3.10 +- Fixed #5896: Blog plugin errors when using custom index pages + +### 4.39.3 August 24, 2023 { id="4.39.3" } + +- Fixed lxml dependency missing in Docker container (4.39.2 regression) + +### 4.39.2 August 23, 2023 { id="4.39.2" } + +- Fixed color palette toggle being reversed (9.2.0 regression) + +### 4.39.1 August 21, 2023 { id="4.39.1" } + +- Fixed git diff in tags plugin after merging back 9.2.0 changes + +### 4.39.0 August 3, 2023 { id="4.39.0" } + +- Added support for hoisting theme media files when building projects +- Added support for sorting pages on tags index for tags plugin +- Added support for adding date of last update to blog posts +- Fixed #5797: Parse error in typeset plugin (4.38.1 regression) + +### 4.38.1 August 1, 2023 { id="4.38.1" } + +- Improved nested serve mode for projects plugin +- Improved compat in privacy plugin with third-party plugins +- Fixed #5790: Typeset plugin ignores data-toc-label attribute +- Fixed #5778: Interplay of privacy plugin with git-revision-date-localized +- Fixed #5773: Info plugin erroring when community edition is in beta + +### 4.38.0 July 29, 2023 { id="4.38.0" } + +- Added projects plugin for building nested projects +- Updated privacy plugin to new MkDocs API + +### 4.37.1 July 28, 2023 { id="4.37.1" } + +- Updated MkDocs to 1.5.1 +- Fixed deprecation warning in social plugin due to MkDocs upgrade +- Fixed #5772: Privacy plugin fails due to API change in MkDocs + +### 4.37.0 July 7, 2023 { id="4.37.0" } + +- Added support for overriding social cards settings per page +- Added new social card `default/only/image` layout +- Improved resilience of optimize and social plugin +- Fixed rendering bugs for pruned navigation items +- Fixed jumping of content tabs anchor links when instant loading is enabled +- Fixed #5676: Optimize plugin doesn't check for `pngquant` + +### 4.36.1 June 23, 2023 { id="4.36.1" } + +- Fixed #5618: Date comparison breaking for drafts in blog plugin + +### 4.36.0 June 15, 2023 { id="4.36.0" } + +- Added support for instant prefetching to speed up slow connections +- Improved stability of anchor link removal in built-in typeset plugin +- Improved performance of regular expressions in typeset plugin +- Removed unnecessary import test for `cairosvg` in optimize plugin +- Fixed #5590: Regular expression for anchor link removal too greedy + +### 4.35.3 June 1, 2023 { id="4.35.3" } + +- Fixed #5579: Abbreviations in headlines filtered by typeset plugin + +### 4.35.2 May 29, 2023 { id="4.35.2" } + +- Fixed #5555: Blog plugin crashes when computing readtime for emojis + +### 4.35.1 May 20, 2023 { id="4.35.1" } + +- Fixed internal handling of errors in social plugin + +### 4.35.0 May 20, 2023 { id="4.35.0" } + +- Improve editing experience and stability of social plugin +- Added support for custom layout syntax validation in social plugin +- Added support for layer origin for easier placement in social plugin +- Added support for in- and exclusion patterns in social plugin +- Catch and print syntax errors in custom layouts + +### 4.34.1 May 16, 2023 { id="4.34.1" } + +- Disable social plugin debug mode by default on mkdocs build +- Added warning in social plugin debug mode when font style couldn't be found +- Set default concurrency of built-in multi-threaded plugins to CPUs - 1 +- Fixed #5521: Social plugin triggers race condition when downloading fonts +- Fixed #5515: Social plugin crashes when concurrency is set to 1 + +### 4.34.0 May 14, 2023 { id="4.34.0" } + +- Added support for new overflow mode to auto-fit text in social plugin +- Reduced subtle rendering bugs in (code) annotations due to subpixel rounding +- Improved print styles for (code) annotation lists +- Improved performance of social plugin, now 3x as fast +- Improved interop of typeset plugin with MkDocstrings +- Fixed logo location for variants of default template in social plugin +- Fixed #5446: Built-in typeset plugin picks up headings in code blocks + +### 4.33.2 May 12, 2023 { id="4.33.2" } + +- Fixed #5508: Social plugin crashes trying to copy cards on Docker/Windows +- Fixed #5507: Social plugin crashes on serve when layouts folder doesn't exist +- Fixed #5505: Social plugin trying to resolve logo in wrong location +- Fixed #5496: Annotations with nested lists incorrectly mounted +- Fixed #5493: Social plugin crashes on Python 3.8 + +### 4.33.1 May 9, 2023 { id="4.33.1" } + +- Added support for SVG background images in social plugin + +### 4.33.0 May 8, 2023 { id="4.33.0" } + +- Added support for custom layouts for social plugin +- Added support for background images for social cards + +### 4.32.6 April 22, 2023 { id="4.32.6" } + +- Fixed #5336: Interplay of blog plugin with git-revision-date-localized + +### 4.32.5 April 7, 2023 { id="4.32.5" } + +- Fixed #5322: Navigation tabs hoist nested page icons + ### 4.32.4 March 24, 2023 { id="4.32.4" } - Fixed #5241: Built-in typeset plugin jams navigation for anchors in headings @@ -322,7 +488,7 @@ ### 4.12.0 March 27, 2022 { id="4.12.0" } - Added support for card grids and grid layouts -- Fixed #3685: Annotations sometimes broken when using instant loading +- Fixed #3685: Annotations sometimes broken when using instant loading - Fixed #3742: Automatically add Mermaid.js when building for offline usage ### 4.11.0 March 6, 2022 { id="4.11.0" } diff --git a/docs/insiders/getting-started.md b/docs/insiders/getting-started.md index cb0368bc0..d178e640a 100644 --- a/docs/insiders/getting-started.md +++ b/docs/insiders/getting-started.md @@ -6,7 +6,7 @@ title: Getting started with Insiders Material for MkDocs Insiders is a compatible drop-in replacement for Material for MkDocs, and can be installed similarly using [`pip`][pip], -[`docker`][docker] or [`git`][git]. Note that in order to access the Insiders +[`docker`][docker] or [`git`][git]. Note that in order to access the Insiders repository, you need to [become an eligible sponsor] of @squidfunk on GitHub. [pip]: #with-pip @@ -18,7 +18,7 @@ repository, you need to [become an eligible sponsor] of @squidfunk on GitHub. After you've been added to the list of collaborators and accepted the repository invitation, the next step is to create a [personal access token] for -your GitHub account in order to access the Insiders repository programmatically +your GitHub account in order to access the Insiders repository programmatically (from the command line or GitHub Actions workflows): 1. Go to https://github.com/settings/tokens @@ -66,7 +66,7 @@ comfortable self-hosting: 6. Install [Pull App] on your fork to stay in-sync with upstream The [`publish`][publish] workflow[^5] is automatically run when a new tag -(release) is created. When a new Insiders version is released on the upstream +(release) is created. When a new Insiders version is released on the upstream 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 @@ -79,13 +79,16 @@ docker login -u ${GH_USERNAME} -p ${GHCR_TOKEN} ghcr.io docker pull ghcr.io/${GH_USERNAME}/mkdocs-material-insiders ``` +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). + [^2]: Earlier, Insiders provided a dedicated Docker image which was available to all sponsors. On March 21, 2021, the image was deprecated for the reasons outlined and discussed in #2442. It was removed on June 1, 2021. [^3]: - When forking a repository, GitHub will disables all workflows. While this + When forking a repository, GitHub will disable all workflows. While this is a reasonable default setting, you need to enable GitHub Actions to be able to automatically build and publish a Docker image on [GitHub Container Registry]. @@ -147,65 +150,45 @@ pip install --upgrade git+https://${GH_TOKEN}@github.com/squidfunk/mkdocs-materi [upgrade guide]: ../upgrade.md -## Caveats +## Built-in plugins -This section describes some aspects to consider when using Insiders together -with Material for MkDocs to ensure that users without access to Insiders can -still build your documentation. +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] +that allows to conditionally load plugins: -### Built-in plugins +``` yaml +plugins: + - search + - social -When using built-in plugins that are solely available via Insiders, it might be -necessary to split the `mkdocs.yml` configuration into a base configuration, and -one with plugin overrides. Note that this is a limitation of MkDocs, which can -be mitigated by using [configuration inheritance]: + # CI=1 mkdocs build + - group: + enabled: !ENV CI + plugins: + - git-revision-date-localized + - git-committers -=== ":octicons-file-code-16: `mkdocs.insiders.yml`" - - ``` yaml - INHERIT: mkdocs.yml - plugins: - - search - - social - - tags - ``` - -=== ":octicons-file-code-16: `mkdocs.yml`" - - ``` yaml - # Configuration with everything except Insiders plugins - ``` - -Now, when you're in an environment with access to Insiders (e.g. in your CI -pipeline), you can build your documentation project with the following lines: - -``` -mkdocs build --config-file mkdocs.insiders.yml + # INSIDERS=1 mkdocs build + - group: + enabled: !ENV INSIDERS + plugins: + - optimize + - privacy ``` -!!! tip "Sharing plugin and extension configuration" +Of course, you can also enable both groups with: - If you want to share `plugins` or `markdown_extensions` between both - configuration files `mkdocs.insiders.yml` and `mkdocs.yml`, you can use - the alternative key-value syntax in both files. The above example would - then look like: - - === ":octicons-file-code-16: `mkdocs.insiders.yml`" - - ``` yaml - INHERIT: mkdocs.yml - plugins: - social: {} - ``` - - === ":octicons-file-code-16: `mkdocs.yml`" - - ``` yaml - # Additional configuration above - plugins: - search: {} - tags: {} - ``` +``` +CI=1 INSIDERS=1 mkdocs build +``` + [^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. + [built-in group plugin]: ../plugins/group.md [configuration inheritance]: https://www.mkdocs.org/user-guide/configuration/#configuration-inheritance diff --git a/docs/insiders/index.md b/docs/insiders/index.md index 6fa81cf0a..6860d5f20 100644 --- a/docs/insiders/index.md +++ b/docs/insiders/index.md @@ -88,14 +88,18 @@ a handful of them, [thanks to our awesome sponsors]! ## What's in it for me? The moment you [become a sponsor][how to become a sponsor], you'll get __immediate -access to 25 additional features__ that you can start using right away, and +access to 23 additional features__ that you can __start using now__, and which are currently exclusively available to sponsors:
-- [x] [Code range selection] :material-alert-decagram:{ .mdx-pulse title="Added on February 19, 2023" } -- [x] [Code annotations: custom selectors] :material-alert-decagram:{ .mdx-pulse title="Added on February 19, 2023" } -- [x] [Privacy plugin: optimization support] :material-alert-decagram:{ .mdx-pulse title="Added on February 6, 2023" } +- [x] [Projects plugin] :material-alert-decagram:{ .mdx-pulse title="Added on July 29, 2023" } +- [x] [Instant prefetching] :material-alert-decagram:{ .mdx-pulse title="Added on June 15, 2023" } +- [x] [Social plugin: custom layouts] :material-alert-decagram:{ .mdx-pulse title="Added on May 8, 2023" } +- [x] [Social plugin: background images] :material-alert-decagram:{ .mdx-pulse title="Added on May 8, 2023" } +- [x] [Code range selection] +- [x] [Code annotations: custom selectors] +- [x] [Privacy plugin: optimization support] - [x] [Optimize plugin] - [x] [Navigation path] (Breadcrumbs) - [x] [Typeset plugin] @@ -104,20 +108,14 @@ which are currently exclusively available to sponsors: - [x] [Tags plugin: allow list] + [custom sorting] - [x] [Blog plugin: custom index pages] - [x] [Blog plugin: related links] -- [x] [Blog plugin] -- [x] [Navigation status] - [x] [Meta plugin] - [x] [Tags plugin: additional indexes] - [x] [Document contributors] - [x] [Automatic light / dark mode] - [x] [Content tabs: anchor links] -- [x] [Navigation pruning] - [x] [Tooltips] -- [x] [Chinese search support] - [x] [Card grids] - [x] [Privacy plugin] -- [x] [Annotations] -- [x] [Navigation icons]
@@ -132,7 +130,7 @@ organization GitHub account for sponsoring. __Important__: If you're sponsoring @squidfunk through a GitHub organization, please send a short email to sponsors@squidfunk.com with the name of your -organization and the GitHub account of the individual that should be added as a +organization and the GitHub account of the individual that should be added as a collaborator.[^4] You can cancel your sponsorship anytime.[^5] @@ -184,18 +182,25 @@ You can cancel your sponsorship anytime.[^5] [![World Wide Technology]](https://wwt.com){ target=_blank title="World Wide Technology" } [![Coda]](https://coda.io){ target=_blank title="Coda" } [![Elastic]](https://elastic.co){ target=_blank title="Elastic" } -[![Hyperledger]](https://www.hyperledger.org){ target=_blank title="Hyperledger Foundation" } [![IP Fabric]](https://ipfabric.io/){ target=_blank title="IP Fabric" } [![Apex.AI]](https://www.apex.ai/){ target=_blank title="Apex.AI" } [![Jitterbit]](https://jitterbit.com/){ target=_blank title="Jitterbit" } [![Sparkfun]](https://sparkfun.com/){ target=_blank title="Sparkfun Electronics" } -[![Automation Technology]](https://automationtechnology.de/){ target=_blank title="Automation Technology" } [![Eccenca]](https://eccenca.com/){ target=_blank title="Eccenca" } [![Neptune]](https://neptune.ai/){ target=_blank title="Neptune" } -[![Cash App]](https://cash.app/){ target=_blank title="Cash App" } [![RackN]](https://rackn.com/){ target=_blank title="RackN" } [![CivicActions]](https://civicactions.com/){ target=_blank title="CivicActions" } [![bitcrowd]](https://bitcrowd.net/){ target=_blank title="bitcrowd" } +[![GetScreen.me]](https://getscreen.me/){ target=_blank title="GetScreen.me" } +[![BotCity]](https://botcity.dev/){ target=_blank title="BotCity" } +[![Springer Nature Technology]](https://www.springernature.com/gp){ target=_blank title="Springer Nature Technology" } +[![Kolena]](https://kolena.io/){ target=_blank title="Kolena" } +[![Evergiving]](https://www.evergiving.com/){ target=_blank title="Evergiving" } +[![Koor]](https://koor.tech/){ target=_blank title="Koor" } +[![Astral]](https://astral.sh/){ target=_blank title="Astral" } +[![Oikolab]](https://oikolab.com/){ target=_blank title="Oikolab" } +[![Bühler Group]](https://www.buhlergroup.com/){ target=_blank title="Bühler Group" } +[![Transformation Flow]](https://transformationflow.io/){ target=_blank title="Transformation Flow" } @@ -213,18 +218,26 @@ You can cancel your sponsorship anytime.[^5] [World Wide Technology]: https://raw.githubusercontent.com/squidfunk/mkdocs-material/master/.github/assets/sponsors/sponsor-wwt.png [Coda]: https://raw.githubusercontent.com/squidfunk/mkdocs-material/master/.github/assets/sponsors/sponsor-coda.png [Elastic]: https://raw.githubusercontent.com/squidfunk/mkdocs-material/master/.github/assets/sponsors/sponsor-elastic.png - [Hyperledger]: https://raw.githubusercontent.com/squidfunk/mkdocs-material/master/.github/assets/sponsors/sponsor-hyperledger.png [IP Fabric]: https://raw.githubusercontent.com/squidfunk/mkdocs-material/master/.github/assets/sponsors/sponsor-ip-fabric.png [Apex.AI]: https://raw.githubusercontent.com/squidfunk/mkdocs-material/master/.github/assets/sponsors/sponsor-apex-ai.png [Jitterbit]: https://raw.githubusercontent.com/squidfunk/mkdocs-material/master/.github/assets/sponsors/sponsor-jitterbit.png [Sparkfun]: https://raw.githubusercontent.com/squidfunk/mkdocs-material/master/.github/assets/sponsors/sponsor-sparkfun.png - [Automation Technology]: https://raw.githubusercontent.com/squidfunk/mkdocs-material/master/.github/assets/sponsors/sponsor-automation-technology.png [Eccenca]: https://raw.githubusercontent.com/squidfunk/mkdocs-material/master/.github/assets/sponsors/sponsor-eccenca.png [Neptune]: https://raw.githubusercontent.com/squidfunk/mkdocs-material/master/.github/assets/sponsors/sponsor-neptune-ai.png [Cash App]: https://raw.githubusercontent.com/squidfunk/mkdocs-material/master/.github/assets/sponsors/sponsor-cashapp.png [RackN]: https://raw.githubusercontent.com/squidfunk/mkdocs-material/master/.github/assets/sponsors/sponsor-rackn.png [CivicActions]: https://raw.githubusercontent.com/squidfunk/mkdocs-material/master/.github/assets/sponsors/sponsor-civic-actions.png [bitcrowd]: https://raw.githubusercontent.com/squidfunk/mkdocs-material/master/.github/assets/sponsors/sponsor-bitcrowd.png + [GetScreen.me]: https://raw.githubusercontent.com/squidfunk/mkdocs-material/master/.github/assets/sponsors/sponsor-getscreenme.png + [BotCity]: https://raw.githubusercontent.com/squidfunk/mkdocs-material/master/.github/assets/sponsors/sponsor-botcity.png + [Springer Nature Technology]: https://raw.githubusercontent.com/squidfunk/mkdocs-material/master/.github/assets/sponsors/sponsor-sn-technology.png + [Kolena]: https://raw.githubusercontent.com/squidfunk/mkdocs-material/master/.github/assets/sponsors/sponsor-kolena.png + [Evergiving]: https://raw.githubusercontent.com/squidfunk/mkdocs-material/master/.github/assets/sponsors/sponsor-evergiving.png + [Koor]: https://raw.githubusercontent.com/squidfunk/mkdocs-material/master/.github/assets/sponsors/sponsor-koor.png + [Astral]: https://raw.githubusercontent.com/squidfunk/mkdocs-material/master/.github/assets/sponsors/sponsor-astral.png + [Oikolab]: https://raw.githubusercontent.com/squidfunk/mkdocs-material/master/.github/assets/sponsors/sponsor-oikolab.png + [Bühler Group]: https://raw.githubusercontent.com/squidfunk/mkdocs-material/master/.github/assets/sponsors/sponsor-buhler.png + [Transformation Flow]: https://raw.githubusercontent.com/squidfunk/mkdocs-material/master/.github/assets/sponsors/sponsor-transformationflow.png
@@ -247,26 +260,10 @@ You can cancel your sponsorship anytime.[^5] The following section lists all funding goals. Each goal contains a list of features prefixed with a checkmark symbol, denoting whether a feature is -:octicons-check-circle-fill-24:{ style="color: #00e676" } already available or +:octicons-check-circle-fill-24:{ style="color: #00e676" } already available or :octicons-check-circle-fill-24:{ style="color: var(--md-default-fg-color--lightest)" } planned, but not yet implemented. When the funding goal is hit, the features are released for general availability. -#### $ 12,000 – Piri Piri - -- [x] [Blog plugin] -- [x] [Chinese search support] -- [x] [Annotations] -- [x] [Navigation icons] -- [x] [Navigation pruning] -- [x] [Navigation status] - - [Blog plugin]: ../setup/setting-up-a-blog.md - [Chinese search support]: ../blog/posts/chinese-search-support.md - [Annotations]: ../reference/annotations.md - [Navigation icons]: ../reference/index.md#setting-the-page-icon - [Navigation pruning]: ../setup/setting-up-navigation.md#navigation-pruning - [Navigation status]: ../reference/index.md#setting-the-page-status - #### $ 14,000 – Goat's Horn - [x] [Privacy plugin] @@ -292,7 +289,7 @@ are released for general availability. - [x] [Tags plugin: allow list] + [custom sorting] - [x] [Navigation subtitles] - [Meta plugin]: ../reference/index.md#built-in-meta-plugin + [Meta plugin]: ../plugins/meta.md [Blog plugin: related links]: ../setup/setting-up-a-blog.md#adding-related-links [Blog plugin: custom index pages]: ../setup/setting-up-a-blog.md#custom-index-pages [Tags plugin: additional indexes]: ../setup/setting-up-tags.md#+tags.tags_extra_files @@ -307,21 +304,27 @@ are released for general availability. - [x] [Navigation path] (Breadcrumbs) - [x] [Privacy plugin: optimization support] - [x] [Privacy plugin: external links] -- [ ] Privacy plugin: external link validation +- [x] [Instant prefetching] - [Optimize plugin]: ../setup/building-an-optimized-site.md#built-in-optimize-plugin - [Typeset plugin]: ../reference/index.md#built-in-typeset-plugin - [Privacy plugin: external links]: ../setup/ensuring-data-privacy.md#+privacy.external_links - [Privacy plugin: optimization support]: ../setup/ensuring-data-privacy.md#+privacy.external_assets_include + [Optimize plugin]: ../plugins/optimize.md + [Typeset plugin]: ../plugins/typeset.md + [Privacy plugin: external links]: ../setup/ensuring-data-privacy.md#+privacy.links + [Privacy plugin: optimization support]: ../setup/ensuring-data-privacy.md#+privacy.assets_include [Navigation path]: ../setup/setting-up-navigation.md#navigation-path - [Instant previews]: https://twitter.com/squidfunk/status/1466794654213492743 + [Instant prefetching]: ../setup/setting-up-navigation.md#instant-prefetching #### $ 24,000 – Blockpaprika +- [x] [Projects plugin] +- [x] [Social plugin: custom layouts] +- [x] [Social plugin: background images] - [x] [Code range selection] - [x] [Code annotations: custom selectors] - [ ] Code line wrap button + [Projects plugin]: ../plugins/projects.md + [Social plugin: custom layouts]: ../setup/setting-up-social-cards.md#customization + [Social plugin: background images]: ../setup/setting-up-social-cards.md#+social.cards_layout_params.background_image [Code range selection]: ../reference/code-blocks.md#code-selection-button [Code annotations: custom selectors]: ../reference/code-blocks.md#custom-selectors @@ -331,6 +334,22 @@ This section lists all funding goals that were previously completed, which means that those features were part of Insiders, but are now generally available and can be used by all users. +#### $ 12,000 – Piri Piri + +- [x] [Blog plugin] +- [x] [Chinese search support] +- [x] [Annotations] +- [x] [Navigation icons] +- [x] [Navigation pruning] +- [x] [Navigation status] + + [Blog plugin]: ../setup/setting-up-a-blog.md + [Chinese search support]: ../blog/posts/chinese-search-support.md + [Annotations]: ../reference/annotations.md + [Navigation icons]: ../reference/index.md#setting-the-page-icon + [Navigation pruning]: ../setup/setting-up-navigation.md#navigation-pruning + [Navigation status]: ../reference/index.md#setting-the-page-status + #### $ 10,000 – Carolina Reaper - [x] [Brand new search plugin] @@ -472,7 +491,7 @@ and configuration options are either backward-compatible or implemented behind feature flags. When working with outside collaborators, it should be rarely necessary to change the general appearance of your site. Most Insiders features enhance the overall experience, e.g. by adding icons to pages or providing a -feedback widget. While this features add value for the user of your site, they +feedback widget. While these features add value for the user of your site, they shouldn't be necessary for previewing when making changes to content. Currently, the only content-related features in Insiders that can't be properly previewed by non-Insiders users are: @@ -517,7 +536,7 @@ __fair use policy__: - Please __don't distribute the source code__ of Insiders. You may freely use it for public, private or commercial projects, privately fork or mirror it, - but please don't make the source code public, as it would counteract the + but please don't make the source code public, as it would counteract the sponsorware strategy. - If you cancel your subscription, you're automatically removed as a diff --git a/docs/philosophy.md b/docs/philosophy.md index 13960e962..cff6baaff 100644 --- a/docs/philosophy.md +++ b/docs/philosophy.md @@ -13,12 +13,12 @@ discusses the [conventions] used in this documentation. a professional static site in minutes. No need to know HTML,CSS or JavaScript – let Material for MkDocs do the heavy lifting for you. -- __Works on all devices__: Serve your documentation with confidence – the - underlying layout automatically adapts to perfectly fit the available screen +- __Works on all devices__: Serve your documentation with confidence – the + underlying layout automatically adapts to perfectly fit the available screen estate, no matter the type or size of the viewing device. - __Made to measure__: Change the colors, fonts, language, icons, logo and much - more with a few lines of configuration. Material for MkDocs can be easily + more with a few lines of configuration. Material for MkDocs can be easily extended and provides tons of options to alter appearance and behavior. - __Fast and lightweight__: Don't let your users wait – get incredible value @@ -33,62 +33,3 @@ discusses the [conventions] used in this documentation. - __Open Source__: Trust 20,000+ users – choose a mature and well-funded solution built with state-of-the-art Open Source technologies. Keep ownership of your content without fear of vendor lock-in. Licensed under MIT. - -## Conventions - -### Symbols - -This documentation use some symbols for illustration purposes. Before you read -on, please make sure you've made yourself familiar with the following list of -conventions: - -[:octicons-heart-fill-24:{ .mdx-heart }   Insiders][Insiders]{ .mdx-insiders } - -: Some features are not yet available in the community edition, but only as - part of the Insiders build of Material for MkDocs. Please consult the - [Insiders] guide to learn how to get access. - -:octicons-tag-24:   __{x.x.x}__ - -: The tag icon in conjunction with a version number denotes when a specific - feature or behavior was added. Make sure you're at least on this version - if you want to use it. - -:octicons-file-code-24:   __{file.ext}__ - -: The source file icon together with a file name is sometimes used in code - examples which span multiple files. The file name (or path) always starts - from the location of `mkdocs.yml`. - -:octicons-milestone-24:   __Default__: _value_ - -: Some properties in `mkdocs.yml` have default values for when the author - does not explicitly define them. The default value of the property is always - included. - -:octicons-unlock-24:   __Feature flag__ - -: Most of the features are hidden behind feature flags, which means they must - be explicitly enabled via `mkdocs.yml`. This allows for the existence of - potentially orthogonal features. - -:octicons-beaker-24:   __Experimental__ - -: Some newer features are still considered experimental, which means they - might (although rarely) change at any time, including their complete removal - (which hasn't happened yet). - - -:octicons-cpu-24:   __Plugin__ - -: Several features are implemented through MkDocs excellent plugin - architecture, some of which are built-in and distributed with Material for - MkDocs, so no installation is required. - -:octicons-package-24:   __Utility__ - -: Besides plugins, there are some utilities that build on top of MkDocs in - order to provide extended functionality, like for example support for - versioning. - - [Insiders]: insiders/index.md diff --git a/docs/plugins/blog.md b/docs/plugins/blog.md new file mode 100644 index 000000000..6eac717d7 --- /dev/null +++ b/docs/plugins/blog.md @@ -0,0 +1,1460 @@ +--- +title: Built-in blog plugin +icon: material/newspaper-variant-outline +--- + +# Built-in blog plugin + +The blog plugin makes it very easy to build a blog, either as a sidecar to +your documentation or as the main thing. Focus on your content while the plugin +does all the heavy lifting, generating a view of all latest posts, [archive] and +[category] pages, configurable [pagination] and much more. + + [archive]: #archive + [category]: #categories + [pagination]: #pagination + +## Objective + +### How it works + +The plugin scans the configured [`posts` directory][config.post_dir] for +`.md` files from which paginated views[^1] are automatically generated. If not +configured otherwise, the plugin expects that your project has the following +directory layout, and will create any missing directories or files for you: + + [^1]: + Views are pages that are automatically generated, i.e., the entry point to + your blog listing all latest posts, as well as [archive] and [category] + pages that list all posts associated with them through [metadata] in + chronological order. + +``` { .sh .no-copy } +. +├─ docs/ +│ └─ blog/ +│ ├─ posts/ +│ └─ index.md +└─ mkdocs.yml +``` + +The `index.md` file in the [`blog` directory][config.blog_dir] is the entry +point to your blog – a paginated view listing all posts in reverse chronological +order. Besides that, the plugin supports automatically creating [archive] and +[category] pages that list a subset of posts for a time interval or category. + +[Post URLs][config.post_url_format] are completely configurable, no matter if +you want your URLs to include the post's date or not. Rendered dates always +display in the locale of the [site language] of your project. Like in other +static blog frameworks, posts can be annotated with a variety of [metadata], +allowing for easy integration with other [built-in plugins], e.g., the +[social] and [tags] plugin. + +Posts can be organized in nested folders with a directory layout that suits your +specific needs, and can make use of all components and syntax that Material for +MkDocs offers, including [admonitions], [annotations], [code blocks], +[content tabs], [diagrams], [icons], [math], and more. + + [metadata]: #metadata + [built-in plugins]: index.md + [social]: social.md + [tags]: tags.md + [admonitions]: ../reference/admonitions.md + [annotations]: ../reference/annotations.md + [code blocks]: ../reference/code-blocks.md + [content tabs]: ../reference/content-tabs.md + [diagrams]: ../reference/diagrams.md + [icons]: ../reference/icons-emojis.md + [math]: ../reference/math.md + +### When to use it + +If you want to add a blog to your project, or migrate from another blog +framework to Material for MkDocs because of its excellent technical writing +capabilities, this plugin is a great choice, as it integrates perfectly with +many other built-in plugins: + +
+ +- :material-file-tree:   __[Built-in meta plugin][meta]__ + + --- + + The meta plugin makes it easy to apply [metadata] to a subset of posts, + including authors, tags, categories, draft status, as well as social card + layouts. + + --- + + __Simpler organization, categorization and management of post metadata__ + +- :material-share-circle:   __[Built-in social plugin][social]__ + + --- + + The social plugin automatically generates beautiful and customizable + social cards for each post and page, showing as previews on social media. + + --- + + __Links to your blog render beautiful social cards when shared on social + media__ + +- :material-rabbit:   __[Built-in optimize plugin][optimize]__ + + --- + + The optimize plugin automatically identifies and optimizes all media files + that you reference in your project by using compression and conversion + techniques. + + --- + + __Your blog loads faster as smaller images are served to your users__ + +- :material-tag-text:   __[Built-in tags plugin][tags]__ + + --- + + The tags plugin allows to categorize posts alongside with pages in your + project, to improve their discoverability and connect posts to your + documentation. + + --- + + __Your documentation's tag system integrates with your blog__ + +
+ + [meta]: meta.md + [social]: social.md + [optimize]: optimize.md + [tags]: tags.md + +## Configuration + + + + + + +As with all [built-in plugins], getting started with the blog plugin is +straightforward. Just add the following lines to `mkdocs.yml`, and you can +start writing your first post: + +``` yaml +plugins: + - blog +``` + +The blog plugin is built into Material for MkDocs and doesn't need to be +installed. + + [blog]: blog.md + [built-in plugins]: index.md + +### General + +The following settings are available: + +--- + +#### + + + + +Use this setting to enable or disable the plugin when [building your project]. +It's normally not necessary to specify this setting, but if you want to disable +the plugin, use: + +``` yaml +plugins: + - blog: + enabled: false +``` + + [building your project]: ../creating-your-site.md#building-your-site + +--- + +#### + + + + +Use this setting to change the path where your blog is located in the +[`docs` directory][mkdocs.docs_dir]. The path is included in the generated +URLs as a prefix for all posts and views. You can change it with: + +=== "Documentation + Blog" + + ``` yaml + plugins: + - blog: + blog_dir: blog + ``` + +=== "Blog only" + + ``` yaml + plugins: + - blog: + blog_dir: . + ``` + +The provided path is resolved from the [`docs` directory][mkdocs.docs_dir]. + +--- + +#### + + + + +Use this setting to leverage the table of contents to display post titles in +views. The value of this setting is inherited by [`archive_toc`] +[config.archive_toc] and [`categories_toc`][config.categories_toc], +unless they are explicitly set: + +``` yaml +plugins: + - blog: + blog_toc: true +``` + +### Posts + +The following settings are available for posts: + +--- + +#### + + + + +Use this setting to change the folder where your posts are located. It's +normally not necessary to change this setting, but if you want to rename the +folder or change its file system location, use: + +``` yaml +plugins: + - blog: + post_dir: "{blog}/articles" +``` + +Note that the [`posts` directory][config.post_dir] is solely used for post +organization – it is not included in post URLs, since they are automatically +and comfortably generated by this plugin. + +The following placeholders are available: + +- `blog` – [`blog` directory][config.blog_dir] + +The provided path is resolved from the [`docs` directory][mkdocs.docs_dir]. + +--- + +#### + + + + +Use this setting to change the date format of posts. This plugin uses [babel] +to render dates in the configured [site language]. You can use [babel]'s +[pattern syntax] or the following shortcodes: + +=== "Monday, January 31, 2023" + + ``` yaml + plugins: + - blog: + post_date_format: full + ``` + +=== "January 31, 2023" + + ``` yaml + plugins: + - blog: + post_date_format: long + ``` + +=== "Jan 31, 2023" + + ``` yaml + plugins: + - blog: + post_date_format: medium + ``` + +=== "1/31/22" + + ``` yaml + plugins: + - blog: + post_date_format: short + ``` + +Note that depending on the [site language], results might look different for +other languages. + + [babel]: https://pypi.org/project/Babel/ + [site language]: ../setup/changing-the-language.md#site-language + [pattern syntax]: https://babel.pocoo.org/en/latest/dates.html#pattern-syntax + +--- + +#### + + + + +Use this setting to change the date format used in post URLs. The format string +must adhere to [babel]'s [pattern syntax] and should not contain whitespace. +Some popular choices: + +=== ":material-link: blog/2023/01/31/:material-dots-horizontal:/" + + ``` yaml + plugins: + - blog: + post_url_date_format: yyyy/MM/dd + ``` + +=== ":material-link: blog/2023/01/:material-dots-horizontal:/" + + ``` yaml + plugins: + - blog: + post_url_date_format: yyyy/MM + ``` + +=== ":material-link: blog/2023/:material-dots-horizontal:/" + + ``` yaml + plugins: + - blog: + post_url_date_format: yyyy + ``` + +If you want to remove the date from post URLs, e.g., when your blog features +mostly evergreen content, you can remove the `date` placeholder from the +[`post_url_format`][config.post_url_format] format string. + +--- + +#### + + + + +Use this setting to change the format string that is used when generating post +URLs. You can freely combine placeholders, and join them with slashes or other +characters: + +=== ":material-link: blog/2023/:material-dots-horizontal:/" + + ``` yaml + plugins: + - blog: + post_url_format: "{date}/{slug}" + ``` + +=== ":material-link: blog/:material-dots-horizontal:/" + + ``` yaml + plugins: + - blog: + post_url_format: "{slug}" + ``` + +The following placeholders are available: + +- `categories` – Post categories, slugified with [`categories_slugify`][config.categories_slugify] +- `date` – Post date, formatted with [`post_url_date_format`][config.post_url_date_format] +- `slug` – Post title, slugified with [`post_slugify`][config.post_slugify], or explicitly set via [`slug`][meta.slug] metadata property +- `file` – Post filename without `.md` file extension + +If you remove the `date` placeholder, make sure that post URLs don't collide +with URLs of other pages hosted under the [`blog` directory][config.blog_dir], +as this leads to undefined behavior. + +--- + +#### + + + + +Use this setting to set an upper bound for the number of categories included in +post URLs if the `categories` placeholder is part of [`post_url_format`] +[config.post_url_format] and the post defines categories: + +``` yaml +plugins: + - blog: + post_url_format: "{categories}/{slug}" + post_url_max_categories: 2 +``` + +If more than one category is given, they are joined with `/` after slugifying. + +--- + +#### + + + + +Use this setting to change the function to use for generating URL-compatible +slugs from post titles. [Python Markdown Extensions] comes with a Unicode-aware +[`slugify`][pymdownx.slugs.slugify] function: + +=== "Unicode" + + ``` yaml + plugins: + - blog: + post_slugify: !!python/object/apply:pymdownx.slugs.slugify + kwds: + case: lower + ``` + +=== "Unicode, case-sensitive" + + ``` yaml + plugins: + - blog: + post_slugify: !!python/object/apply:pymdownx.slugs.slugify + ``` + +When your project features non-European languages, it's advisable to use this +configuration. Of course, you can also provide a custom slugification function +for more granular control. + + [toc.slugify]: https://github.com/Python-Markdown/markdown/blob/1337d0891757e192165668d2606db36cf08e65a9/markdown/extensions/toc.py#L26-L33 + [pymdownx.slugs.slugify]: https://github.com/facelessuser/pymdown-extensions/blob/01c91ce79c91304c22b4e3d7a9261accc931d707/pymdownx/slugs.py#L59-L65 + [Python Markdown Extensions]: https://facelessuser.github.io/pymdown-extensions/extras/slugs/ + +--- + +#### + + + + +Use this setting to change the separator that is passed to the slugification +function set as part of [`post_slugify`][config.post_slugify]. While the default +is a hyphen, it can be set to any string, e.g., `_`: + +``` yaml +plugins: + - blog: + post_slugify_separator: _ +``` + +--- + +#### + + + + +By default, the plugin makes post excerpts optional. When a post doesn't define +an excerpt, views include the entire post. This setting can be used to make +post excerpts required: + +=== "Optional" + + ``` yaml + plugins: + - blog: + post_excerpt: optional + ``` + +=== "Required" + + ``` yaml + plugins: + - blog: + post_excerpt: required + ``` + +When post excerpts are required, posts without excerpt separators raise an +error. Thus, this setting is useful when you want to make sure that all posts +have excerpts defined. + +--- + +#### + + + + +Use this setting to set an upper bound for the number of authors rendered in +post excerpts. While each post may be written by multiple authors, this setting +allows to limit the display to just a few or even a single author, or disable +authors in post excerpts: + +=== "Render up to 2 authors" + + ``` yaml + plugins: + - blog: + post_excerpt_max_authors: 2 + ``` + +=== "Disable authors" + + ``` yaml + plugins: + - blog: + post_excerpt_max_authors: 0 + ``` + +This only applies to post excerpts in views. Posts always render all authors. + +--- + +#### + + + + +Use this setting to set an upper bound for the number of categories rendered in +post excerpts. While each post may be assigned to multiple categories, this +setting allows to limit the display to just a few or even a single category, or +disable categories in post excerpts: + +=== "Render up to 2 categories" + + ``` yaml + plugins: + - blog: + post_excerpt_max_categories: 2 + ``` + +=== "Disable categories" + + ``` yaml + plugins: + - blog: + post_excerpt_max_categories: 0 + ``` + +This only applies to post excerpts in views. Posts always render all categories. + +--- + +#### + + + + +Use this setting to set the separator the plugin will look for in a post's +content when generating post excerpts. All content __before__ the separator is +considered to be part of the excerpt: + +``` yaml +plugins: + - blog: + post_excerpt_separator: +``` + +It is common practice to use an HTML comment as a separator. + +--- + +#### + + + + +Use this setting to control whether the plugin should automatically compute the +reading time of a post, which is then rendered in post excerpts, as well as in +posts themselves: + +``` yaml +plugins: + - blog: + post_readtime: false +``` + +--- + +#### + + + + +Use this setting to change the number of words that a reader is expected to read +per minute when computing the reading time of a post. If you want to fine-tune +it, use: + +``` yaml +plugins: + - blog: + post_readtime_words_per_minute: 300 +``` + +A reading time of 265 words per minute is considered to be the +[average reading time of an adult]. + + [average reading time of an adult]: https://help.medium.com/hc/en-us/articles/214991667-Read-time + +### Archive + +The following settings are available for archive pages: + +--- + +#### + + + + +Use this setting to enable or disable archive pages. An archive page shows all +posts for a specific interval (e.g. year, month, etc.) in reverse order. If you +want to disable archive pages, use: + +``` yaml +plugins: + - blog: + archive: false +``` + +--- + +#### + + + + +Use this setting to change the title of the archive section the plugin adds to +the navigation. If this setting is omitted, it's sourced from the translations. +If you want to change it, use: + +``` yaml +plugins: + - blog: + archive_name: Archive +``` + +--- + +#### + + + + +Use this setting to change the date format used for archive page titles. The +format string must adhere to [babel]'s [pattern syntax]. Some popular choices: + +=== "2023" + + ``` yaml + plugins: + - blog: + archive_date_format: yyyy + ``` + +=== "January 2023" + + ``` yaml + plugins: + - blog: + archive_date_format: MMMM yyyy + ``` + +Note that depending on the [site language], results might look different for +other languages. + +--- + +#### + + + + +Use this setting to change the date format used for archive page URLs. The +format string must adhere to [babel]'s [pattern syntax] and should not contain +whitespace. Some popular choices: + +=== ":material-link: blog/archive/2023/" + + ``` yaml + plugins: + - blog: + archive_url_date_format: yyyy + ``` + +=== ":material-link: blog/archive/2023/01/" + + ``` yaml + plugins: + - blog: + archive_url_date_format: yyyy/MM + ``` + +--- + +#### + + + + +Use this setting to change the format string that is used when generating +archive page URLs. You can freely combine placeholders, and join them with +slashes or other characters: + +=== ":material-link: blog/archive/2023/" + + ``` yaml + plugins: + - blog: + archive_url_format: "archive/{date}" + ``` + +=== ":material-link: blog/2023/" + + ``` yaml + plugins: + - blog: + archive_url_format: "{date}" + ``` + +The following placeholders are available: + +- `date` – Archive date, formatted with [`archive_url_date_format`][config.archive_url_date_format] + +--- + +#### + + + + +Use this setting to leverage the table of contents to display post titles on all +archive pages. The value of this setting is inherited from [`blog_toc`] +[config.blog_toc], unless its explicitly set: + +``` yaml +plugins: + - blog: + archive_toc: true +``` + +### Categories + +The following settings are available for category pages: + +--- + +#### + + + + +Use this setting to enable or disable category pages. A category page shows all +posts for a specific category in reverse chronological order. If you want to +disable category pages, use: + +``` yaml +plugins: + - blog: + categories: false +``` + +--- + +#### + + + + +Use this setting to change the title of the category section the plugin adds to +the navigation. If this setting is omitted, it's sourced from the translations. +If you want to change it, use: + +``` yaml +plugins: + - blog: + categories_name: Categories +``` + +--- + +#### + + + + +Use this setting to change the format string that is used when generating +category page URLs. You can freely combine placeholders, and join them with +slashes or other characters: + +=== ":material-link: blog/category/:material-dots-horizontal:/" + + ``` yaml + plugins: + - blog: + categories_url_format: "category/{slug}" + ``` + +=== ":material-link: blog/:material-dots-horizontal:/" + + ``` yaml + plugins: + - blog: + categories_url_format: "{slug}" + ``` + +The following placeholders are available: + +- `slug` – Category, slugified with [`categories_slugify`][config.categories_slugify] + +--- + +#### + + + + +Use this setting to change the function to use for generating URL-compatible +slugs from categories. [Python Markdown Extensions] comes with a Unicode-aware +[`slugify`][pymdownx.slugs.slugify] function: + +=== "Unicode" + + ``` yaml + plugins: + - blog: + categories_slugify: !!python/object/apply:pymdownx.slugs.slugify + kwds: + case: lower + ``` + +=== "Unicode, case-sensitive" + + ``` yaml + plugins: + - blog: + categories_slugify: !!python/object/apply:pymdownx.slugs.slugify + ``` +When your project features non-European languages, it's advisable to use this +configuration. + +--- + +#### + + + + +Use this setting to change the separator that is passed to the slugification +function set as part of [`categories_slugify`][config.categories_slugify]. While +the default is a hyphen, it can be set to any string, e.g., `_`: + +``` yaml +plugins: + - blog: + categories_slugify_separator: _ +``` + +--- + +#### + + + + +The plugin allows to check categories against a predefined list, in order to +catch typos or make sure that categories are not arbitrarily added. Specify the +categories you want to allow with: + +``` yaml +plugins: + - blog: + categories_allowed: + - Search + - Performance +``` + +The plugin stops the build if a post references a category that is not part of +this list. Posts can be assigned to categories by using the [`categories`] +[meta.categories] metadata property. + +--- + +#### + + + + +Use this setting to leverage the table of contents to display post titles on all +category pages. The value of this setting is inherited from [`blog_toc`] +[config.blog_toc], unless its explicitly set: + +``` yaml +plugins: + - blog: + categories_toc: true +``` + +### Pagination + +The following settings are available for pagination: + +--- + +#### + + + + +Use this setting to enable or disable pagination in views – generated pages +that show posts or subsets of posts in reverse chronological order. If you want +to disable pagination, use: + +``` yaml +plugins: + - blog: + pagination: false +``` + +--- + +#### + + + + +Use this setting to change the number of posts rendered per page. If you have +rather long post excerpts, it can be a good idea to reduce the number of posts +per page: + +``` yaml +plugins: + - blog: + pagination_per_page: 5 +``` + +--- + +#### + + + + +Use this setting to change the format string that is used when generating +paginated view URLs. You can freely combine placeholders, and join them with +slashes or other characters: + +=== ":material-link: blog/page/n/" + + ``` yaml + plugins: + - blog: + pagination_url_format: "page/{page}" + ``` + +=== ":material-link: blog/n/" + + ``` yaml + plugins: + - blog: + pagination_url_format: "{page}" + ``` + +The following placeholders are available: + +- `page` – Page number + +--- + +#### + + + + +The plugin uses the [paginate] module to generate the pagination markup using a +special syntax. Use this setting to customize how pagination is constructed. +Some popular choices: + +=== "1 2 3 .. n" + + ``` yaml + plugins: + - blog: + pagination_format: "~2~" + ``` + +=== "1 2 3 .. n :material-chevron-right: :material-chevron-double-right:" + + ``` yaml + plugins: + - blog: + pagination_format: "$link_first $link_previous ~2~ $link_next $link_last" + ``` + +=== "1 :material-chevron-right:" + + ``` yaml + plugins: + - blog: + pagination_format: "$link_previous $page $link_next" + ``` + +The following placeholders are supported by [paginate]: + +- `#!css $first_page` – Number of first reachable page +- `#!css $last_page` – Number of last reachable page +- `#!css $page` – Number of currently selected page +- `#!css $page_count` – Number of reachable pages +- `#!css $items_per_page` – Maximal number of items per page +- `#!css $first_item` – Index of first item on the current page +- `#!css $last_item` – Index of last item on the current page +- `#!css $item_count` – Total number of items +- `#!css $link_first` – Link to first page (unless on first page) +- `#!css $link_last` – Link to last page (unless on last page) +- `#!css $link_previous` – Link to previous page (unless on first page) +- `#!css $link_next` – Link to next page (unless on last page) + + [paginate]: https://pypi.org/project/paginate/ + +--- + +#### + + + + +Use this setting to control whether pagination should be automatically disabled +when the view only consists of a single page. If you want to always render +pagination, use: + +``` yaml +plugins: + - blog: + pagination_if_single_page: true +``` + +--- + +#### + + + + +Use this setting to enable or disable persistence of content, i.e., if paginated +views should also display the content of their containing view. If you want to +enable this behavior, use: + +``` yaml +plugins: + - blog: + pagination_keep_content: true +``` + +### Authors + +The following settings are available for authors: + +--- + +#### + + + + +Use this setting to enable or disable post authors. If this setting is enabled, +the plugin will look for a file named [`.authors.yml`][config.authors_file] and +render authors in posts and views. Disable this behavior with: + +``` yaml +plugins: + - blog: + authors: false +``` + +--- + +#### + + + + +Use this setting to change the path of the file where the author information for +your posts resides. It's normally not necessary to change this setting, but if +you need to, use: + +``` yaml +plugins: + - blog: + authors_file: "{blog}/.authors.yml" +``` + +The following placeholders are available: + +- `blog` – [`blog` directory][config.blog_dir] + +The provided path is resolved from the [`docs` directory][mkdocs.docs_dir]. + +!!! info "Format of author information" + + The `.authors.yml` file must adhere to the following format: + + ``` yaml title=".authors.yml" + authors: + : + name: string # Author name + description: string # Author description + avatar: url # Author avatar + ``` + + Note that `` must be set to an identifier for associating authors + with posts, e.g., a GitHub username like `squidfunk`. This identifier can + then be used in the [`authors`][meta.authors] metadata property of + a post. Multiple authors are supported. As an example, see + [the `.authors.yml` file][.authors.yml] we're using for our blog. + + [.authors.yml]: https://github.com/squidfunk/mkdocs-material/blob/master/docs/blog/.authors.yml + +### Drafts + +The following settings are available for drafts: + +--- + +#### + + + + +Rendering [draft posts][meta.draft] can be useful in deploy previews. Use this +setting to specify whether the plugin should include posts marked as drafts when +[building your project]: + +=== "Render drafts" + + ``` yaml + plugins: + - blog: + draft: true + ``` + +=== "Don't render drafts" + + ``` yaml + plugins: + - blog: + draft: false + ``` + +--- + +#### + + + + +Use this setting to control whether the plugin should include posts marked as +drafts when [previewing your site]. If you don't wish to include draft posts +when previewing, use: + +``` yaml +plugins: + - blog: + draft_on_serve: false +``` + + [previewing your site]: ../creating-your-site.md#previewing-as-you-write + +--- + +#### + + + + +The plugin can automatically mark posts with future dates as drafts. When the +date is past today, the post is automatically included when +[building your project], unless explicitly marked as draft: + +``` yaml +plugins: + - blog: + draft_if_future_date: true +``` + +## Usage + +### Metadata + +Posts can define a handful of metadata properties that specify how the plugin +renders them, in which views they are integrated, and how they are linked to +each other. The metadata of each post is validated against a schema to allow for +a quicker discovery of syntax errors. + +The following properties are available: + +--- + +#### + + + + + +Use this property to associate a post with [authors] by providing a list of +identifiers as defined in the [`authors_file`][config.authors_file]. If an +author can't be resolved, the plugin will terminate with an error: + +``` yaml +--- +authors: + - squidfunk # (1)! +--- + +# Post title +... +``` + +1. Authors are linked by using their identifiers. As an example, see + [the `.authors.yml` file][.authors.yml] we're using for our blog. + + [authors]: #authors + +--- + +#### + + + + + +Use this property to associate a post with one or more [categories][category], +making the post a part of the generated category page. Categories are defined +as a list of strings (whitespaces are allowed): + +``` yaml +--- +categories: + - Search + - Performance +--- + +# Post title +... +``` + +If you want to prevent accidental typos assigning categories to posts, you +can set a predefined list of allowed categories in `mkdocs.yml` by using +the [`categories_allowed`][config.categories_allowed] setting. + +--- + +#### + + + + + +Use this property to specify a post's date. Note that this property is required, +which means the build fails when it's not set. Additional dates can be set by +using a slightly different syntax: + +=== "Date" + + ``` yaml + --- + date: 2023-01-31 + --- + + # Post title + ... + ``` + +=== "Update date" + + ``` yaml + --- + date: + created: 2023-01-31 # (1)! + updated: 2023-02-01 + --- + + # Post title + ... + ``` + + 1. Each post must have a creation date set. + +=== "Custom date" + + ``` yaml + --- + date: + created: 2023-01-31 + my_custom_date: 2023-02-01 # (1)! + --- + + # Post title + ... + ``` + + 1. The blog plugin validates all dates and allows to format them with + [babel]'s [pattern syntax] in templates. When using theme extension, + authors can add custom dates to templates. + + This was first requested in #5733. + +The following date formats are supported: + +- `2023-01-31` +- `2023-01-31T12:00:00` + +--- + +#### + + + + + +Use this property to mark a post as draft. The plugin allows to include or +exclude posts marked as drafts when [building your project] using the +[`draft`][config.draft] setting. Mark a post as draft with: + +``` yaml +--- +draft: true +--- + +# Post title +... +``` + +--- + +#### + + + + + + + +Use this property to define a list of links that are rendered in the sidebar of +a post. The property follows the same syntax as [`nav`][mkdocs.nav] in +`mkdocs.yml`, supporting sections and even anchors: + +=== "Links" + + ``` yaml + --- + links: + - setup/setting-up-site-search.md + - insiders/index.md + --- + + # Post title + ... + ``` + +=== "Links with sections" + + ``` yaml + --- + links: + - setup/setting-up-site-search.md + - Insiders: + - insiders/index.md + - insiders/getting-started.md + --- + + # Post title + ... + ``` + +=== "Links with anchors" + + ``` yaml + --- + links: + - plugins/search.md # (1)! + - Insiders: + - insiders/index.md#how-to-become-a-sponsor + - insiders/getting-started.md#requirements + --- + + # Post title + ... + ``` + + 1. If a link defines an anchor, the plugin resolves the anchor from the + linked page and sets the anchor title as a [subtitle]. + +All relative links are resolved from the [`docs` directory][mkdocs.docs_dir]. + + [subtitle]: ../reference/index.md#setting-the-page-subtitle + +--- + +#### + + + + + +Use this property to explicitly set the reading time of a post in minutes. When +[`post_readtime`][config.post_readtime] is enabled, the plugin computes the +reading time of a post, which can be overridden with: + +``` yaml +--- +readtime: 15 +--- + +# Post title +... +``` + +--- + +#### + + + + + +Use this property to explicitly set the slug of a post. By default, the slug of +a post is automatically computed by the [`post_slugify`][config.post_slugify] +function from the post's title, which can be overridden with: + +``` yaml +--- +slug: help-im-trapped-in-a-universe-factory +--- + +# Post title +... +``` + +Slugs are passed to [`post_url_format`][config.post_url_format]. + +--- + +!!! question "Missing something?" + + When setting up your blog or migrating from another blog framework, you + might discover that you're missing specific functionality – we're happy to + consider adding it to the plugin! You can [open a discussion] to + ask a question, or create a [change request] on our [issue tracker], so we + can find out if it might be a good fit for the plugin. + + [open a discussion]: https://github.com/squidfunk/mkdocs-material/discussions + [change request]: ../contributing/requesting-a-change.md + [issue tracker]: https://github.com/squidfunk/mkdocs-material/issues diff --git a/docs/plugins/group.md b/docs/plugins/group.md new file mode 100644 index 000000000..37b41e11d --- /dev/null +++ b/docs/plugins/group.md @@ -0,0 +1,121 @@ +--- +title: Built-in group plugin +icon: material/format-list-group +--- + +# Built-in group plugin + +The group plugin allows to group plugins into logical units to conditionally +enable or disable them for specific environments with the use of +[environment variables][mkdocs.env], e.g., to only enable a subset of +plugins when [building your project] during continuous integration (CI). + + [building your project]: ../creating-your-site.md#building-your-site + +## Objective + +### How it works + +The plugin conditionally and lazily loads all plugins that are part of a group +if and only if the group is enabled, which means that the plugin doesn't add any +overhead when the group is disabled. It also means that the grouped plugins +only need to be installed when the group is enabled. + +The plugins that are part of the group are executed in the same order as if +they were defined at the top-level in the list of [`plugins`][mkdocs.plugins]. +Thus, order is preserved and deterministic. + +### When to use it + +Whenever you're using multiple plugins that are only required in specific +environments, e.g., when building your project during continuous integration +(CI), the plugin is the perfect utility for making configuration simpler, as it +removes the need for splitting configuration into multiple files. + +It can be used with any built-in or third-party plugin. + +## Configuration + + + + + + +As with all [built-in plugins], getting started with the group plugin is +straightforward. Just add the following lines to `mkdocs.yml`, and start +splitting plugins into logical units: + +``` yaml +plugins: + - group +``` + +The group plugin is built into Material for MkDocs and doesn't need to be +installed. + + [group]: group.md + [built-in plugins]: index.md + +### General + +The following settings are available: + +--- + +#### + + + + +Use this setting to enable or disable the plugin when [building your project]. +The plugin behaves differently than all other built-in plugins – __it is +disabled by default__. To enable a group, use: + +``` yaml +plugins: + - group: + enabled: !ENV CI # (1)! +``` + +1. If you only want to use the group plugin for better organization and + always want to enable the plugins that are part of it, use: + + ``` yaml + plugins: + - group: + enabled: true + ``` + +The decision to disable the plugin by default was made to simplify the usage +of environment variables, as it removes the need to provide a default value for +an environment variable. + +Now, when [building your project], you can enable a group by setting the +[environment variable][mkdocs.env]: + +``` sh +CI=true mkdocs build +``` + + [building your project]: ../creating-your-site.md#building-your-site + +--- + +#### + + + + +Use this setting to list the plugins that are part of the group. The syntax is +exactly the same as for the [`plugins`][mkdocs.plugins] setting, so you can +simply copy the list of plugins that you want to group, e.g: + +``` yaml +plugins: + - group: + plugins: + - optimize + - minify +``` + +The plugins mentioned here are just used for illustration purposes. diff --git a/docs/plugins/index.md b/docs/plugins/index.md new file mode 100644 index 000000000..892441890 --- /dev/null +++ b/docs/plugins/index.md @@ -0,0 +1,246 @@ +# Built-in plugins + +Material for MkDocs started out as a theme for [MkDocs][mkdocs], but has since +evolved into a full-fledged framework for building and maintaining documentation. +The theme is still the core of the project, but it's now accompanied by a +growing number of complementary built-in plugins. + +We strive to make those plugins as modular and generic as possible, so that they +can be used in a wide variety of projects and use cases. By providing useful +default settings, we also try to make them as easy to use as possible, so that +you can get started quickly, tweaking their settings later on. When +developing built-in plugins, we always adhere to the following design principles: + +- **Modularity:** Built-in plugins are designed to be modular, so that they can + be easily combined to implement sophisticated pipelines. For example, the + [offline], [optimize] and [privacy] plugins can be used together to build + truly [offline-capable documentation]. + +- **Interoperability:** Built-in plugins are designed to be as compatible as + possible, so they can be used in combination with other plugins, including + third-party plugins. We strive to make it simple to integrate with the vast + ecosystem that has evolved around [MkDocs][mkdocs]. + +- **Performance:** Built-in plugins are designed to be as fast and + memory-efficient as possible, so that they don't unnecessarily slow down + builds. This is particularly important for large documentation projects with + thousands of pages. + + [mkdocs]: https://www.mkdocs.org/ + [design principles]: ../design-principles.md + [offline-capable documentation]: ../setup/building-for-offline-usage.md + +## Categories + +### Management + +The following plugins greatly improve the authoring experience when working on +documentation projects by providing better management capabilities, from the +management of plugins, multiple projects, and metadata, to the creation of +minimal reproductions for bug reports: + +
+ +- :material-format-list-group:   __[Built-in group plugin][group]__ + + --- + + The group plugin allows to group plugins into logical units to conditionally + enable or disable them for specific environments with the use of + [environment variables][mkdocs.env]. + + --- + + __Optimal management of plugins when building in different environments__ + +- :material-file-tree:   __[Built-in meta plugin][meta]__ + + --- + + The meta plugin makes it easy to manage metadata (front matter) for all + pages in a folder, so a certain subset of pages uses specific tags or a + custom template. + + --- + + __Simpler organization, categorization and management of metadata__ + +- :material-folder-open:   __[Built-in projects plugin][projects]__ + + --- + + The projects plugin allows to split your main project into multiple distinct + projects, build them concurrently and preview them together as one. + + --- + + __Connect multiple projects together, and build them separately or as one__ + +- :material-information:   __[Built-in info plugin][info]__ + + --- + + The info plugin is a small and useful utility that helps to create + self-contained minimal reproductions, so we maintainers can fix reported + bugs more quickly. + + --- + + __Your bug reports are of the highest quality, so we can fix them as fast as + possible__ + + +
+ + [group]: group.md + [info]: info.md + [meta]: meta.md + [projects]: meta.md + +### Optimization + +The following plugins are designed to help you build optimized documentation, +making it more accessible to your users through faster loading times, better +search engine rankings, beautiful preview images on social media, and GDPR +compliance with a few lines of configuration: + +
+ +- :material-share-circle:   __[Built-in social plugin][social]__ + + --- + + The social plugin automatically generates beautiful and customizable + social cards for each page of your documentation, showing as previews on + social media. + + --- + + __Links to your site render beautiful social cards when shared on social + media__ + +- :material-rabbit:   __[Built-in optimize plugin][optimize]__ + + --- + + The optimize plugin automatically identifies and optimizes all media files + that you reference in your project by using compression and conversion + techniques. + + --- + + __Your site loads faster as smaller images are served to your users__ + +- :material-shield-account:   __[Built-in privacy plugin][privacy]__ + + --- + + The privacy plugin downloads external assets automatically for easy + self-hosting, allowing for GDPR compliance with a single line of + configuration. + + --- + + __Your documentation can be made GDPR compliant with minimal effort__ + +- :material-connection:   __[Built-in offline plugin][offline]__ + + --- + + The offline plugin adds support for building [offline-capable documentation], + so you can distribute the [`site` directory][mkdocs.site_dir] as a `.zip` + file that can be downloaded. + + --- + + __Your documentation can work without connectivity to the internet__ + +
+ + [offline]: offline.md + [optimize]: optimize.md + [privacy]: privacy.md + [social]: social.md + +### Content + +The following plugins are designed to help you set up a blog, provide search +functionality to your users, add tags to pages and posts, and use the same +typesetting capabilities in specific parts of the documentation exactly as in +the main content: + +
+ +- :material-newspaper-variant-outline:   __[Built-in blog plugin][blog]__ + + --- + + The blog plugin adds first-class support for blogging to Material for + MkDocs, either as a sidecar to your documentation or as a standalone + installation. + + --- + + __Your blog is built with the same powerful engine as your documentation__ + +- :material-magnify:   __[Built-in search plugin][search]__ + + --- + + The search plugin adds a search bar to the header, allowing users to search + the entire documentation, so it's easier for them to find what they're + looking for. + + --- + + __Your documentation is searchable without any external services, even + offline__ + +- :material-tag-text:   __[Built-in tags plugin][tags]__ + + --- + + The tags plugin adds first-class support for categorizing pages with tags, + adding the ability to group related pages to improve the discovery of + related content. + + --- + + __Your pages are categorized with tags, yielding additional context__ + +- :material-format-title:   __[Built-in typeset plugin][typeset]__ + + --- + + The typeset plugin allows to preserve the enriched presentation of titles + and headlines within the navigation and table of contents. + + --- + + __Sidebars preserve the same formatting as section titles in pages__ + +
+ + [blog]: blog.md + [search]: search.md + [tags]: tags.md + [typeset]: typeset.md + +## Architecture + +### Multiple instances + +Several built-in plugins have support for multiple instances, which means that +they can be used multiple times in the same configuration file, allowing to +fine-tune behavior for separate sections of your project. Currently, the +following plugins have support for multiple instances: + +
+ +- [Built-in blog plugin][blog] +- [Built-in group plugin][group] +- [Built-in optimize plugin][optimize] +- [Built-in privacy plugin][privacy] +- [Built-in social plugin][social] + +
diff --git a/docs/plugins/info.md b/docs/plugins/info.md new file mode 100644 index 000000000..b422daa71 --- /dev/null +++ b/docs/plugins/info.md @@ -0,0 +1,155 @@ +--- +title: Built-in info plugin +icon: material/information +--- + +# Built-in info plugin + +The info plugin is a utility that is solely intended to create self-contained +[minimal reproductions] as `.zip` files when [reporting bugs] or proposing +[change requests], making communication between us maintainers and you much +easier, as we have a common ground to work on. + + [minimal reproductions]: ../guides/creating-a-reproduction.md + [reporting bugs]: ../contributing/reporting-a-bug.md + [change requests]: ../contributing/requesting-a-change.md + +## Objective + +### How it works + +The plugin helps you to prepare a minimal reproduction by collecting the +necessary information about the environment and configuration of your project. +This makes it easier for us to fix bugs, as it requires that you +[upgrade to the latest version] and [remove your customizations]. + +When following these principles, you can be confident that you don't report a +bug that has already been fixed in a subsequent release, or which is caused by +one of your customizations. Even more importantly, you actively help +us to fix the bug as quickly as possible. + +The output of the plugin is a `.zip` file that you can share with us maintainers. + + [Upgrade to the latest version]: ../contributing/reporting-a-bug.md#upgrade-to-latest-version + [Remove your customizations]: ../contributing/reporting-a-bug.md#remove-customizations + + +### When to use it + +Whenever you're [reporting a bug][reporting bugs] or have something to discuss, +like a question or [change request][change requests], you should attach +a small, self-contained minimal reproduction. Runnable examples help to make +communication much more efficient, giving us maintainers more time to benefit +more users by pushing the project forward. Minimal reproductions are mandatory +for bug reports. + +## Configuration + + + + +In order to get started with the built-in info plugin, just add the following +lines to `mkdocs.yml`, and quickly [create a minimal reproduction] to share +with us maintainers: + +``` yaml +plugins: + - info +``` + +The info plugin is built into Material for MkDocs and doesn't need to be +installed. + + [info]: info.md + [create a minimal reproduction]: ../guides/creating-a-reproduction.md + +### General + +The following settings are available: + +--- + +#### + + + + +Use this setting to enable or disable the plugin when [building your project]. +It's normally not necessary to specify this setting, but if you want to disable +the plugin, use: + +``` yaml +plugins: + - info: + enabled: false +``` + + [building your project]: ../creating-your-site.md#building-your-site + +--- + +#### + + + + +Use this setting to control whether the plugin should be enabled when +[previewing your site]. It's normally not necessary to specify this setting, +but if you want to change this behavior, use: + +``` yaml +plugins: + - info: + enabled_on_serve: true +``` + +This setting streamlines the process of creating and inspecting minimal +reproductions, as it allows to quickly iterate on the reproduction without +having to disable the plugin first. + + [previewing your site]: ../creating-your-site.md#previewing-as-you-write + +### Archive + +--- + +#### + + + + +Use this setting to control whether the plugin should create a `.zip` file +from the project or exit after the version check. This setting is solely +intended for debugging the plugin itself: + +``` yaml +plugins: + - info: + archive: false +``` + +--- + +#### + + + + +Use this setting to control whether the plugin should stop creating the `.zip` +file when one of the [requirements] is not satisfied. This setting must only be +used when [reporting a bug][reporting bugs] that is related to a customization +[explicitly mentioned in our documentation]. You can change it with: + +``` yaml +plugins: + - info: + archive_stop_on_violation: false +``` + +If you're using this setting when [reporting a bug][reporting bugs], please +explain why you think it is necessary to include customizations. If you're +unsure, please ask us first by [creating a discussion]. + + [requirements]: #how-it-works + [explicitly mentioned in our documentation]: ?q=%22extends+base%22 + [creating a discussion]: https://github.com/squidfunk/mkdocs-material/discussions diff --git a/docs/plugins/meta.md b/docs/plugins/meta.md new file mode 100644 index 000000000..3c4f72669 --- /dev/null +++ b/docs/plugins/meta.md @@ -0,0 +1,195 @@ +--- +title: Built-in meta plugin +icon: material/file-tree +--- + +# Built-in meta plugin + +The meta plugin solves the problem of setting metadata (front matter) for all +pages in a folder, i.e., a subsection of your project, which is particularly +useful to ensure that a certain subset of pages features specific tags, uses a +custom template, or is attributed to an author. + +## Objective + +### How it works + +The plugin scans the [`docs` directory][mkdocs.docs_dir] for `.meta.yml` files, +and recursively merges the contents of those files with the metadata (front +matter) of all pages that are contained in the same folder and all subfolders. +For example, if you want to add the tag Example to +multiple pages, use: + +``` yaml title=".meta.yml" +tags: + - Example +``` + +Now, given the following directory layout, if you store the file in the folder +named `example`, all pages in that folder receive the tag, while all pages +outside of the folder remain unaffected: + +``` { .sh .no-copy hl_lines="4-8" } +. +├─ docs/ +│ ├─ ... +│ ├─ example/ +│ │ ├─ .meta.yml +│ │ ├─ a.md +│ │ ├─ ... +│ │ └─ z.md +│ └─ ... +└─ mkdocs.yml +``` + +When combining metadata, lists and dictionaries are recursively merged, which +means you can append values to a list and add or set specific properties in a +dictionary on arbitrary levels. + +### When to use it + +While the plugin itself doesn't offer much functionality beyond adding and +merging metadata, it is a perfect companion for many of the other built-in +plugins that Material for MkDocs offers. Some of the most powerful combinations +of the meta plugin and other built-in plugins are: + +
+ +- :material-share-circle:   __[Built-in social plugin][social]__ + + --- + + The meta plugin can be used to [change the layout] for social cards or + [change specific layout options] like [background] or [color] + for a subset of pages. + + ``` yaml title=".meta.yml" + social: + cards_layout: default/variant + ``` + +- :material-newspaper-variant-outline:   __[Built-in blog plugin][blog]__ + + --- + + The meta plugin allows to automatically associate blog posts with specific + [authors] and [categories], ensuring that blog posts are always correctly + annotated. + + ``` yaml title=".meta.yml" + authors: + - squidfunk + ``` + +- :material-tag-text:   __[Built-in tags plugin][tags]__ + + --- + + The meta plugin makes it possible to ensure that subsections of your + project are annotated with [specific tags], so they can't be forgotten when + adding pages. + + ``` yaml title=".meta.yml" + tags: + - Example + ``` + +- :material-magnify:   __[Built-in search plugin][search]__ + + --- + + The meta plugin makes it easy to [boost] specific sections in search results + or to [exclude] them entirely from being indexed, giving more granular + control over search. + + ``` yaml title=".meta.yml" + search: + exclude: true + ``` + +
+ + [social]: social.md + [change the layout]: social.md#meta.social.cards_layout + [change specific layout options]: social.md#meta.social.cards_layout_options + [background]: social.md#option.background_color + [color]: social.md#option.color + [blog]: blog.md + [authors]: blog.md#meta.authors + [categories]: blog.md#meta.categories + [tags]: tags.md + [specific tags]: tags.md#meta.tags + [search]: search.md + [exclude]: search.md#meta.search.exclude + [boost]: search.md#meta.search.boost + +## Configuration + + + + + + +As with all [built-in plugins], getting started with the meta plugin is +straightforward. Just add the following lines to `mkdocs.yml`, and start +applying metadata for multiple pages at once: + +``` yaml +plugins: + - meta +``` + +The meta plugin is included with Material for MkDocs and doesn't need to be +installed. + + [meta]: meta.md + [built-in plugins]: index.md + +### General + +The following settings are available: + +--- + +#### + + + + + +Use this setting to enable or disable the plugin when [building your project]. +It's normally not necessary to specify this setting, but if you want to disable +the plugin, use: + +``` yaml +plugins: + - meta: + enabled: false +``` + + [building your project]: ../creating-your-site.md#building-your-site + +### Meta file + +The following settings are available for meta files: + +--- + +#### + + + + + +Use this setting to change the meta file name the plugin will look for when +scanning the [`docs` directory][mkdocs.docs_dir]. It's normally not necessary to +change this setting, but if you want to change it, use: + +``` yaml +plugins: + - meta: + meta_file: .meta.yml +``` + +The provided path is resolved from the [`docs` directory][mkdocs.docs_dir] +recursively. diff --git a/docs/plugins/offline.md b/docs/plugins/offline.md new file mode 100644 index 000000000..760c01b90 --- /dev/null +++ b/docs/plugins/offline.md @@ -0,0 +1,153 @@ +--- +title: Built-in offline plugin +icon: material/connection +--- + + +# Built-in offline plugin + +[MkDocs][mkdocs] is one of the few frameworks that allow to build offline-capable +documentation that can be directly viewed by the user – no server needed. With +the offline plugin, you can distribute the [`site` directory][mkdocs.site_dir] +as a downloadable `.zip` file while retaining most interactive functionality. + +## Objective + +### How it works + +After [building your project], switch to the [`site` directory][mkdocs.site_dir] +and open `index.html` in your browser – you're now viewing your documentation +from your local file system! Most browsers will denote this by showing `file://` +in the address bar. However, you'll realize that the site search is gone. + +Material for MkDocs offers many interactive features, some of which will not +work from the local file system due to the restrictions of modern browsers. More +specifically and technically, all calls to the [Fetch API] will error with a +message like: + +``` +Cross origin requests are only supported for protocol schemes: http, [...] +``` + +While browsers impose those restriction for security reasons, it reduces the +interactivity of your project. The offline plugin makes sure that site search +keeps working by moving the search index to a JavaScript file, and leveraging +@squidfunk's [iframe-worker] shim. + +Additionally, the plugin automatically disables the [`use_directory_urls`] +[mkdocs.use_directory_urls] setting, ensuring that users can open your +documentation directly from the local file system. + +There are some [limitations]. + + [building your project]: ../creating-your-site.md#building-your-site + [Fetch API]: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API + [iframe-worker]: https://github.com/squidfunk/iframe-worker + [limitations]: #limitations + +### When to use it + +As the name already indicates, the plugin should only be used when you're +[building your project] for offline distribution. It's also good to know, that +the offline plugin plays nicely with the following other plugins, helping to +create even better offline-capable documentation: + +
+ +- :material-shield-account:   __[Built-in privacy plugin][privacy]__ + + --- + + The privacy plugin makes it easy to use external assets when building for + offline usage, as it automatically downloads them for distribution with + your documentation. + + --- + + __Your documentation can work without connectivity to the internet[^1]__ + +- :material-rabbit:   __[Built-in optimize plugin][optimize]__ + + --- + + The optimize plugin automatically identifies and optimizes all media files + that you reference in your project by using compression and conversion + techniques. + + --- + + __Your documentation can be distributed as a smaller `.zip` download__ + +
+ + [^1]: + You might wonder why the [privacy plugin][privacy] is necessary to build + truly offline-capable documentation with the offline plugin. While it's + certainly possible to also add support for downloading external assets to + the offline plugin, this functionality is already fully implemented in the + privacy plugin and is its very raison d'être. + + Material for MkDocs follows a modular approach for its plugin system – many + of the plugins work perfectly together and enhance each others + functionalities, allowing to solve complex problems with a few lines + of configuration. + + [privacy]: privacy.md + [optimize]: optimize.md + +## Configuration + + + + +As with all [built-in plugins], getting started with the offline plugin is +straightforward. Just add the following lines to `mkdocs.yml`, and start +building offline-capable documentation: + +``` yaml +plugins: + - offline +``` + +The offline plugin is built into Material for MkDocs and doesn't need to be +installed. + + [offline]: offline.md + [built-in plugins]: index.md + +### General + +The following settings are available: + +--- + +#### + + + + +Use this setting to enable or disable the plugin when [building your project]. +If you want to build online- as well as offline-capable documentation, it's a +good idea to use an [environment variable][mkdocs.env]: + +``` yaml +plugins: + - offline: + enabled: !ENV [OFFLINE, false] +``` + +## Limitations + +When enabling the offline plugin, make sure to disable the following settings, +as they make use of the [Fetch API] which will error when invoked from the local +file system: + +- [Instant loading] +- [Site analytics] +- [Versioning] +- [Comment systems] + + [Instant loading]: ../setup/setting-up-navigation.md#instant-loading + [Site analytics]: ../setup/setting-up-site-analytics.md + [Versioning]: ../setup/setting-up-versioning.md + [Comment systems]: ../setup/adding-a-comment-system.md diff --git a/docs/plugins/optimize.md b/docs/plugins/optimize.md new file mode 100644 index 000000000..a30f7fb39 --- /dev/null +++ b/docs/plugins/optimize.md @@ -0,0 +1,443 @@ +--- +title: Built-in optimize plugin +icon: material/rabbit +--- + +# Built-in optimize plugin + +The optimize plugin automatically identifies and optimizes all media files when +[building your project] by using common compression and conversion techniques. +As a result, your site loads significantly faster and yields better rankings in +search engines. + + [building your project]: ../creating-your-site.md#building-your-site + +## Objective + +### How it works + +The plugin scans the [`docs` directory][mkdocs.docs_dir] for media files and +assets, optimizing them automatically in order to reduce the final size of the +[`site` directory][mkdocs.site_dir]. This leads to faster loading times as you +ship less bytes to your users, as well as a smaller download for +[offline-capable documentation]. + +Optimized images are [intelligently cached][intelligent caching], which is why +the plugin will only optimize media files that changed since the last build. +This makes it possible to swap out or update images, without having to worry +about optimizing them, or even worse, forgetting to do so. + +In order to optimize media files, a few [dependencies] need to be available on +your system. + + [offline-capable documentation]: ../setup/building-for-offline-usage.md + [dependencies]: #configuration + +### When to use it + +It's generally recommended to use the plugin, as media files are optimized +automatically without the need for intervention, ensuring that your site loads +as fast as possible. Optimized media files are one of the key components for a +high and consistent ranking in search engines. + +Additionally, the plugin can be combined with other built-in plugins +that Material for MkDocs offers, in order to create sophisticated +build pipelines tailored to your project: + +
+ +- :material-shield-account:   __[Built-in privacy plugin][privacy]__ + + --- + + The privacy plugin makes it easy to use unoptimized external assets, passing + them to the optimize plugin before copying them to the [`site` directory] + [mkdocs.site_dir]. + + --- + + __External media files can be automatically downloaded and optimized__ + +- :material-connection:   __[Built-in offline plugin][offline]__ + + --- + + The offline plugin adds support for building offline-capable documentation, + so you can distribute the [`site` directory][mkdocs.site_dir] as a `.zip` + file that can be downloaded. + + --- + + __Your documentation can be distributed as a smaller `.zip` download__ + +
+ + [privacy]: privacy.md + [offline]: offline.md + +## Configuration + + + + + + + +As with all [built-in plugins], getting started with the optimize plugin is +straightforward. Just add the following lines to `mkdocs.yml`, and observe how +media files are optimized automatically: + +``` yaml +plugins: + - optimize +``` + +The optimize plugin is built into Material for MkDocs and doesn't need to be +installed. + +However, in order to optimize all media files, it's necessary to install the +dependencies for [image processing], if they're not already available on your +system. The linked guide includes instructions for several operating systems +and mentions some alternative environments. + + [optimize]: optimize.md + [built-in plugins]: index.md + [image processing]: requirements/image-processing.md + +### General + +The following settings are available: + +--- + +#### + + + + + +Use this setting to enable or disable the plugin when [building your project]. +If you want to disable the plugin, e.g., for local builds, you can use an +[environment variable][mkdocs.env] in `mkdocs.yml`: + +``` yaml +plugins: + - optimize: + enabled: !ENV [CI, false] +``` + +This configuration enables the plugin only during continuous integration (CI). + +--- + +#### + + + + + +With more CPUs available, the plugin can do more work in parallel, and thus +complete media file optimization faster. If you want to disable concurrent +processing completely, use: + +``` yaml +plugins: + - optimize: + concurrency: 1 +``` + +By default, the plugin uses all available CPUs - 1 with a minimum of 1. + +### Caching + +The plugin implements an [intelligent caching] mechanism, ensuring that a media +file or asset is only passed through the optimization pipeline when its contents +change. If you swap out or update an image, the plugin detects it and updates +the optimized version of the media file. + +The following settings are available for caching: + + [intelligent caching]: requirements/caching.md + +--- + +#### + + + + + +Use this setting to instruct the plugin to bypass the cache, in order to +re-optimize all media files, even though the cache may not be stale. It's +normally not necessary to specify this setting, except for when debugging +the plugin itself. Caching can be disabled with: + +``` yaml +plugins: + - optimize: + cache: false +``` + +--- + +#### + + + + + +It is normally not necessary to specify this setting, except for when you want +to change the path within your root directory where media files are cached. +If you want to change it, use: + +``` yaml +plugins: + - optimize: + cache_dir: my/custom/dir +``` + +If you're using [multiple instances] of the plugin, it can be a good idea to +set different cache directories for both instances, so that they don't interfere +with each other. + + [multiple instances]: index.md#multiple-instances + +### Optimization + +Documentation often makes use of screenshots or diagrams for better +visualization of things, both of which are prime candidates for optimization. +The plugin automatically optimizes images using [pngquant] for `.png` files, +and [Pillow] for `.jpg` files. + +The following settings are available for optimization: + + [pngquant]: https://pngquant.org/ + [Pillow]: https://pillow.readthedocs.io/ + +--- + +#### + + + + + +Use this setting to enable or disable media file optimization. Currently, +the plugin's sole purpose is to optimize media files, so it's equivalent to the +[`enabled`][config.enabled] setting, but in the near future, other features +might be added. If you want to disable optimization, use: + +``` yaml +plugins: + - optimize: + optimize: false +``` + +--- + +#### + + + + + +Use this setting to enable or disable the optimization of `.png` files. It's +normally not necessary to specify this setting, but if you want to disable +the optimization of `.png` files, use: + +``` yaml +plugins: + - optimize: + optimize_png: false +``` + +--- + +#### + + + + + +Use this setting to specify the speed/quality tradeoff that [pngquant] applies +when optimizing `.png` files. The lower the number, the more aggressively +[pngquant] will try to optimize: + +=== "Slower smaller" + + ``` yaml + plugins: + - optimize: + optimize_png_speed: 1 + ``` + +=== "Faster larger" + + ``` yaml + plugins: + - optimize: + optimize_png_speed: 10 + ``` + +A factor of `10` has 5% lower quality, but is 8x faster than the default `3`. + +--- + +#### + + + + + +Use this setting to specify whether [pngquant] should strip optional metadata +from `.png` files that are not required to display the image, e.g., [EXIF]. +If you want to preserve metadata, use: + +``` yaml +plugins: + - optimize: + optimize_png_strip: false +``` + + [EXIF]: https://en.wikipedia.org/wiki/Exif + +--- + +#### + + + + + +Use this setting to enable or disable the optimization of `.jpg` files. It's +normally not necessary to specify this setting, but if you want to disable +the optimization of `.jpg` files, use: + +``` yaml +plugins: + - optimize: + optimize_jpg: false +``` + +--- + +#### + + + + + +Use this setting to specify the image quality that [Pillow] applies when +optimizing `.jpg` files. If the images look blurry, it's a good idea to +fine-tune and change this setting: + +``` yaml +plugins: + - optimize: + optimize_jpg_quality: 75 +``` + +--- + +#### + + + + + +Use this setting to specify whether [Pillow] should use progressive encoding +when optimizing `.jpg` files, rendering faster on slow connections. If you want +to disable progressive encoding, use: + +``` yaml +plugins: + - optimize: + optimize_jpg_progressive: false +``` + + [progressive encoding]: https://medium.com/hd-pro/jpeg-formats-progressive-vs-baseline-73b3938c2339 + +--- + +#### + + + + + +Use this setting to enable media file optimization for specific directories +of your project, e.g., when using [multiple instances] of the plugin to optimize +media files differently: + +``` yaml +plugins: + - optimize: + optimize_include: + - screenshots/* +``` + +This configuration enables optimization for all media files that are contained +in the `screenshots` folder and its subfolders inside the [`docs` directory] +[mkdocs.docs_dir]. + +--- + +#### + + + + + +Use this setting to disable media file optimization for specific directories +of your project, e.g., when using [multiple instances] of the plugin to optimize +media files differently: + +``` yaml +plugins: + - social: + optimize_exclude: + - vendor/* +``` + +This configuration disables optimization for all media files that are contained +in the `vendor` folder and its subfolders inside the [`docs` directory] +[mkdocs.docs_dir]. + +### Reporting + +The following settings are available for reporting: + +--- + +#### + + + + + +Use this setting to control whether the plugin should print the number of bytes +gained after optimizing each file. If you want to disable this behavior, use: + +``` yaml +plugins: + - optimize: + print_gain: false +``` + +--- + +#### + + + + + +Use this setting to control whether the plugin should print the total number of +bytes gained after optimizing all files. If you want to disable this behavior, +use: + +``` yaml +plugins: + - optimize: + print_gain_summary: false +``` diff --git a/docs/plugins/privacy.md b/docs/plugins/privacy.md new file mode 100644 index 000000000..d4141ac25 --- /dev/null +++ b/docs/plugins/privacy.md @@ -0,0 +1,416 @@ +--- +title: Built-in privacy plugin +icon: material/shield-account +--- + + +# Built-in privacy plugin + +The privacy plugin offers a streamlined solution for automatically self-hosting +external assets. With just a single line of configuration, the plugin can +automatically identify and download external assets, making GDPR compliance +as effortless as it can possibly be. + +## Objective + +### How it works + +The plugin scans the generated HTML for external assets, i.e., scripts, style +sheets, images, and web fonts, downloads them, stores them in the +[`site` directory][mkdocs.site_dir] and replaces all references with links to +the downloaded copies for effortless self-hosting. For example: + +``` html + +``` + +This external script is downloaded, and the link is replaced with: + +``` html + +``` + +Of course, scripts and style sheets can reference further external assets, +which is why this process is repeated recursively until no further external +assets are detected: + +- Scripts are scanned for further scripts, style sheets and JSON files +- Style sheets are scanned for images and web fonts + +Additionally, hints like [`preconnect`][preconnect], used to reduce latency when +requesting external assets, are removed from the output, as they're not +necessary when self-hosting. After the plugin has done it's work, your project +will be free of requests to external services. + +There are some [limitations]. + + [preconnect]: https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel/preconnect + [limitations]: #limitations + +### When to use it + +The plugin was developed to make compliance with the 2018 European +__General Data Protection Regulation__ (GDPR) as simple as possible, while +retaining the flexibility and power that Material for MkDocs offers, like for +example its tight integration with [Google Fonts]. + +But, that's only the start. For example, if your project includes a lot of +images, enabling the plugin allows to move them outside of your repository, as +the plugin will automatically download and store them in the [`site` directory] +[mkdocs.site_dir] when [building your project]. + +Even more interestingly, the plugin can be combined with other built-in plugins +that Material for MkDocs offers, in order to create sophisticated build +pipelines tailored to your project: + +
+ +- :material-rabbit:   __[Built-in optimize plugin][optimize]__ + + --- + + The optimize plugin allows to optimize all downloaded external assets + detected by the privacy plugin by using compression and conversion + techniques. + + --- + + __External media files are automatically downloaded and optimized__ + +- :material-connection:   __[Built-in offline plugin][offline]__ + + --- + + The offline plugin adds support for building [offline-capable documentation], + so you can distribute the [`site` directory][mkdocs.site_dir] as a `.zip` + file that can be downloaded. + + --- + + __Your documentation can work without connectivity to the internet__ + +
+ + [Google Fonts]: ../setup/changing-the-fonts.md + [building your project]: ../creating-your-site.md#building-your-site + [optimize]: optimize.md + [offline]: offline.md + [offline-capable documentation]: ../setup/building-for-offline-usage.md + +## Configuration + + + + + + + +As with all [built-in plugins], getting started with the privacy plugin is +straightforward. Just add the following lines to `mkdocs.yml`, and start +effortlessly self-hosting external assets: + +``` yaml +plugins: + - privacy +``` + +The privacy plugin is built into Material for MkDocs and doesn't need to be +installed. + + [privacy]: privacy.md + [built-in plugins]: index.md + +### General + +The following settings are available: + +--- + +#### + + + + + +Use this setting to enable or disable the plugin when [building your project]. +If you want to disable the plugin, e.g., for local builds, you can use an +[environment variable][mkdocs.env] in `mkdocs.yml`: + +``` yaml +plugins: + - privacy: + enabled: !ENV [CI, false] +``` + +This configuration enables the plugin only during continuous integration (CI). + +--- + +#### + + + + + +With more CPUs available, the plugin can do more work in parallel, and thus +complete handling of external assets faster. If you want to disable concurrent +processing completely, use: + +``` yaml +plugins: + - privacy: + concurrency: 1 +``` + +By default, the plugin uses all available CPUs - 1 with a minimum of 1. + +### Caching + +The plugin implements an [intelligent caching] mechanism, ensuring that external +assets are only downloaded when they're not already contained in the cache. +While the initial build might take some time, it's a good idea to use caching, +as it will speed up consecutive builds. + +The following settings are available for caching: + + [intelligent caching]: requirements/caching.md + +--- + +#### + + + + + +Use this setting to instruct the plugin to bypass the cache, in order to +re-schedule downloads for all external assets, even though the cache may not be +stale. It's normally not necessary to specify this setting, except for when +debugging the plugin itself. Caching can be disabled with: + +``` yaml +plugins: + - privacy: + cache: false +``` + +--- + +#### + + + + + +It is normally not necessary to specify this setting, except for when you want +to change the path within your root directory where downloaded copies are +cached. If you want to change it, use: + +``` yaml +plugins: + - privacy: + cache_dir: my/custom/dir +``` + +If you're using [multiple instances] of the plugin, it can be a good idea to +set different cache directories for both instances, so that they don't interfere +with each other. + + [multiple instances]: index.md#multiple-instances + +### External assets + +The following settings are available for external assets: + +--- + +#### + + + + + +Use this setting to control whether the plugin should download external +assets. If you only want the plugin to process [external links], you can disable +handling of external assets with: + +``` yaml +plugins: + - privacy: + assets: false +``` + + [external links]: #external-links + +--- + +#### + + + + + +Use this setting to control whether the plugin should downloads or only report +external assets when they're encountered. If you already self-host all external +assets, this setting can be used as a safety net to detect links to external +assets placed by the author in pages: + +``` yaml +plugins: + - privacy: + assets_fetch: true +``` + +--- + +#### + + + + + +It is normally not necessary to specify this setting, except for when you want +to change the path within the [`site` directory][mkdocs.site_dir] where +external assets are stored. If you want to change it, use: + +``` yaml +plugins: + - privacy: + assets_fetch_dir: my/custom/dir +``` + +This configuration stores the downloaded copies at `my/custom/dir` in the +[`site` directory][mkdocs.site_dir]. + +--- + +#### + + + + + +Use this setting to enable downloading of external assets for specific origins, +e.g., when using [multiple instances] of the plugin to fine-tune processing of +external assets for different origins: + +``` yaml +plugins: + - privacy: + assets_include: + - unsplash.com/* +``` + +--- + +#### + + + + + +Use this setting to disable downloading of external assets for specific origins, +e.g., when using [multiple instances] of the plugin to fine-tune processing of +external assets for different origins: + +``` yaml +plugins: + - privacy: + assets_exclude: # (1)! + - cdn.jsdelivr.net/npm/mathjax@3/* + - giscus.app/* +``` + +1. [MathJax] loads web fonts for typesetting of mathematical content + through relative URLs, and thus cannot be automatically bundled by the + privacy plugin. [MathJax can be self-hosted]. + + [Giscus], which we recommend to use as a [comment system], uses a technique + called code-splitting to load only the code that is necessary, which + is implemented via relative URLs. [Giscus can be self-hosted] as well. + + [MathJax]: ../reference/math.md + [MathJax can be self-hosted]: https://docs.mathjax.org/en/latest/web/hosting.html + [Giscus]: https://giscus.app/ + [comment system]: ../setup/adding-a-comment-system.md + [Giscus can be self-hosted]: https://github.com/giscus/giscus/blob/main/SELF-HOSTING.md + +--- + +### External links + +The following settings are available for external links: + +--- + +#### + + + + + +Use this setting to instruct the plugin to parse and process external links to +annotate them for [improved security], or to automatically add additional +attributes to external links. If you want to disable processing of external +links, use: + +``` yaml +plugins: + - privacy: + links: false +``` + + [improved security]: https://developer.chrome.com/en/docs/lighthouse/best-practices/external-anchors-use-rel-noopener/ + +--- + +#### + + + + + +Use this setting to specify additional attributes that should be added to +external links, for example, to add `target="_blank"` to all external links +so they open in a new tab: + +``` yaml +plugins: + - privacy: + links_attr_map: + target: _blank +``` + +--- + +#### + + + + + +It is normally not recommended to change this setting, as it will automatically +annotate external links that open in a new window with `rel="noopener"` for +[improved security]: + +``` yaml +plugins: + - privacy: + links_noopener: true +``` + +## Limitations + +Dynamically created URLs as part of scripts are not detected, and thus cannot be +downloaded automatically, as the plugin does not execute scripts – it only detects fully qualified URLs for downloading and replacement. In short, don't do this: + +``` js +const cdn = "https://polyfill.io" +const url = `${cdn}/v3/polyfill.min.js` +``` + +Instead, always use fully qualified URLs: + +``` js +const url ="https://polyfill.io/v3/polyfill.min.js" +``` diff --git a/docs/plugins/projects.md b/docs/plugins/projects.md new file mode 100644 index 000000000..e989e7d7d --- /dev/null +++ b/docs/plugins/projects.md @@ -0,0 +1,365 @@ +--- +title: Built-in projects plugin +icon: material/folder-open +--- + +# Built-in projects plugin + +The projects plugin adds the ability to split your main project into multiple +distinct projects, build them concurrently and preview them together as one. +This is particularly useful when creating a multi-language project, but can also +be used to split very large projects into smaller parts. + +## Objective + +### How it works + +The plugin scans the configured [`projects` directory][config.projects_dir] for +`mkdocs.yml` files, identifies all nested projects and builds them concurrently. +If not configured otherwise, the plugin expects that your project has +the following directory layout, e.g. for a multi-language project: + +``` { .sh .no-copy } +. +├─ docs/ +├─ projects/ +│ ├─ en/ +│ │ ├─ docs/ +│ │ └─ mkdocs.yml +│ └─ de/ +│ ├─ docs/ +│ └─ mkdocs.yml +└─ mkdocs.yml +``` + +One of the most useful and interesting features of the plugin is that it allows +[previewing your site] from the main project, while still being able to preview +and build each project individually. This is especially useful for +multi-language projects. + +If, when [previewing your site], you change a file in one of the projects, the +plugin only rebuilds this project and makes sure that MkDocs will also reload +the associated files. This also creates the opportunity for splitting your +main project into several projects for a better editing experience. + +There are some [limitations], but we're working hard to remove them. + + [previewing your site]: ../creating-your-site.md#previewing-as-you-write + [limitations]: #limitations + +### When to use it + +The plugin came into existence because we needed a convenient and scalable +method to build our [examples] repository, which features many self-contained +and runnable projects that users can download and use as a basis when +boostrapping a new project or [creating a reproduction]. + +When you want to create a multi-language project, or have a very large existing +project, you might consider using the plugin, as it makes managing, editing +and building more comfortable. + + [examples]: https://github.com/mkdocs-material/examples + [creating a reproduction]: ../guides/creating-a-reproduction.md + +## Configuration + + + + + + +In order to get started with the projects plugin, just add the following lines +to `mkdocs.yml`, and split your main project into several distinct projects that +can be built concurrently: + +``` yaml +plugins: + - projects +``` + +The projects plugin is built into Material for MkDocs and doesn't need to be +installed. + + [projects]: projects.md + +### General + +The following settings are available: + +--- + +#### + + + + + +Use this setting to enable or disable the plugin when [building your project]. +If you want to disable the plugin, e.g., for local builds, you can use an +[environment variable][mkdocs.env] in `mkdocs.yml`: + +``` yaml +plugins: + - projects: + enabled: !ENV [CI, false] +``` + +This configuration enables the plugin only during continuous integration (CI). + + [building your project]: ../creating-your-site.md#building-your-site + +--- + +#### + + + + + +With more CPUs available, the plugin can do more work in parallel, and thus +build projects faster. If you want to disable concurrent processing completely, +use: + +``` yaml +plugins: + - projects: + concurrency: 1 +``` + +By default, the plugin uses all available CPUs - 1 with a minimum of 1. + +### Caching + +The plugin implements an [intelligent caching] mechanism, ensuring that a +project is only rebuilt when its contents change. While the initial build might +take some time, it's a good idea to use caching, as it will speed up consecutive +builds. + +The following settings are available for caching: + + [intelligent caching]: requirements/caching.md + +--- + +#### + + + + + +Use this setting to instruct the plugin to bypass the cache, in order to +rebuild all projects, even though the cache may not be stale. It's normally not +necessary to specify this setting, except for when debugging the plugin itself. +Caching can be disabled with: + +``` yaml +plugins: + - projects: + cache: false +``` + +--- + +#### + + + + + +It is normally not necessary to specify this setting, except for when you want +to change the path within your root directory where the metadata is cached. +If you want to change it, use: + +``` yaml +plugins: + - projects: + cache_dir: my/custom/dir +``` + +### Projects + +The following settings are available for projects: + +--- + +#### + + + + + +Use this setting to enable or disable building of projects. Currently, the +plugin's sole purpose is to build projects, so it's equivalent to the +[`enabled`][config.enabled] setting, but in the future, other features might be +added. If you want to disable building of projects, use: + +``` yaml +plugins: + - projects: + projects: false +``` + +--- + +#### + + + + + +Use this setting to change the folder where your projects are located. It's +normally not necessary to change this setting, but if you want to rename the +folder or change its file system location, use: + +``` yaml +plugins: + - projects: + projects_dir: projects +``` + +Note that the [`projects` directory][config.projects_dir] is solely used for +project organization – it is not included in project URLs, since projects are +automatically hoisted by the plugin. + +The provided path is resolved from the root directory. + +--- + +#### + + + + + +Use this setting to change the location or name of configuration files the +plugin will look for when scanning the [`projects` directory] +[config.projects_dir]. Adjusting this setting can be necessary when the +configuration files are located in subdirectories of projects, e.g. +`docs/mkdocs.yml`: + +``` yaml +plugins: + - projects: + projects_config_files: "**/mkdocs.yml" # (1)! +``` + +1. If all projects share the same location for their configuration files, e.g., + `docs/mkdocs.yml`, it's advisable to fully qualify the path, as it's faster + to resolve than a `**` glob pattern. + + ``` yaml + plugins: + - projects: + projects_config_files: "*/docs/mkdocs.yml" + ``` + + This configuration fits the following directory structure, which is quite + common for projects using git submodules: + + ``` { .sh .no-copy } + . + ├─ docs/ + ├─ projects/ + │ ├─ git-submodule-a/ + │ │ └─ docs/ + │ │ └─ mkdocs.yml + │ └─ git-submodule-b/ + │ └─ docs/ + │ └─ mkdocs.yml + └─ mkdocs.yml + ``` + +The provided path is resolved from the [`projects` directory] +[config.projects_dir]. + +--- + +#### + + + + + +Use this setting to transform the configuration of each project as read from +`mkdocs.yml` before it is built, which allows for adjusting the configuration +of each project when building them together, but leave them untouched when +building them individually: + +``` yaml +plugins: + - projects: + projects_config_transform: !!python/name:projects.transform +``` + +The provided module and function name are looked up in Python's [module search +path]. You need to add your root directory to the search path when building +your site, so Python can resolve it. The easiest way is to add the working +directory to the [`PYTHONPATH`][PYTHONPATH] environment variable: + +``` .sh +export PYTHONPATH=. +``` + +!!! tip "How to define a configuration transformation function" + + The [`python/name`][python-name] tag is provided by [PyYAML] and must point + to a valid module and function name within Python's [module search path]. + The plugin passes the `project` and top-level `config` objects to the + function. + + As an example, we can inherit the [`use_directory_urls`] + [mkdocs.use_directory_urls] setting for all projects from the top-level + configuration: + + ``` py title="projects/__init__.py" + from mkdocs.config.defaults import MkDocsConfig + + # Transform project configuration + def transform(project: MkDocsConfig, config: MkDocsConfig): + project.use_directory_urls = config.use_directory_urls + ``` + + [module search path]: https://docs.python.org/3/library/sys_path_init.html + [PYTHONPATH]: https://docs.python.org/3/using/cmdline.html#envvar-PYTHONPATH + [python-name]: https://pyyaml.org/wiki/PyYAMLDocumentation#yaml-tags-and-python-types + [PyYAML]: https://pyyaml.org/ + +### Hoisting + +The following settings are available for hoisting: + +--- + +#### + + + + + +Use this setting to enable or disable hoisting of themes files to the main +project. If you disable this setting, each project receives a copy of the +theme's files, which can be considered redundant: + +``` yaml +plugins: + - projects: + hoisting: false +``` + +It's generally advisable to enable hoisting, as it yields faster deployments +and faster loading of your project's sites, because the files are the same for +all projects and can be deduplicated. + +### Limitations + +The plugin is one of the latest additions to Material for MkDocs, which means it +is rather young and has some limitations. We're working hard to remove them, and +we're happy to receive feedback and learn about your requirements in ?5800. +Current limitations are: + +- __Basic multi-language support only__: we'll be investigating how to provide + better support for multi-language projects, allowing to easier interlink + projects and switch between them. + +- __Separate search indexes and sitemaps__: currently, the projects are entirely + separate, which means they will have separate search indexes and sitemaps. diff --git a/docs/plugins/requirements/caching.md b/docs/plugins/requirements/caching.md new file mode 100644 index 000000000..63b3f4a9e --- /dev/null +++ b/docs/plugins/requirements/caching.md @@ -0,0 +1,35 @@ +--- +icon: material/database-outline +--- + +# Caching + +Some of the [built-in plugins] implement intelligent caching mechanisms, which +massively speed up consecutive builds by reducing the amount of work that needs +to be done. This guide explains how to configure caching in different +environments. + +## Prerequisites + +Caching is entirely optional but enabled by default. It can be disabled per +plugin. If not configured otherwise, plugins will cache their data in the +`.cache` folder in the root of your project. For this reason it's recommended +to create a `.gitignore` file in the root of your project: + +``` title=".gitignore" +.cache +``` + +This ensures that cached files are not added to your git repository – something +that is generally not recommended to do unless absolutely necessary. In some +cases, you might need to check in cached files, e.g. when you need to +pre-generate [social cards] locally, e.g., when you're not be able to install +the image processing dependencies in your continuous integration (CI) +environment. + +In this case, we recommend changing the `cache_dir` setting – something that all +plugins that implement caching share – to a folder which you add to your git +repository. + + [built-in plugins]: ../index.md + [social cards]: ../../setup/setting-up-social-cards.md diff --git a/docs/setup/dependencies/image-processing.md b/docs/plugins/requirements/image-processing.md similarity index 74% rename from docs/setup/dependencies/image-processing.md rename to docs/plugins/requirements/image-processing.md index ae053e05f..c53cbf6ad 100644 --- a/docs/setup/dependencies/image-processing.md +++ b/docs/plugins/requirements/image-processing.md @@ -1,21 +1,38 @@ +--- +icon: material/image-sync-outline +--- + # Image processing -Material for MkDocs depends on several libraries to allow for image processing -as part of the build pipeline, including [social cards] and [image optimization]. -For this reason, a few external libraries must be installed on the host system. -This section explains how to install them. +Some of the [built-in plugins] depend on external libraries for efficient image +processing, most notably the [social] plugin to generate [social cards], and the +[optimize] plugin for applying [image optimization]. This guide explains how to +install those libraries in different environments. - [social cards]: ../setting-up-social-cards.md - [image optimization]: ../building-an-optimized-site.md + [built-in plugins]: ../index.md + [social]: ../social.md + [social cards]: ../../setup/setting-up-social-cards.md + [optimize]: ../optimize.md + [image optimization]: ../../setup/building-an-optimized-site.md ## Dependencies -Install the Python dependencies for image processing with: +The libraries for image processing are entirely optional, and only need to be +installed if you want to use the [social] plugin or the [optimize] plugin. The +libraries are listed under the `imaging` extra: ``` -pip install pillow cairosvg +pip install "mkdocs-material[imaging]" ``` +This will install compatible versions of the following packages: + +- [Pillow] +- [CairoSVG] + + [Pillow]: https://pillow.readthedocs.io/ + [CairoSVG]: https://cairosvg.org/ + ### Cairo Graphics [Cairo Graphics] is a graphics library and dependency of [Pillow], which @@ -36,9 +53,8 @@ Material for MkDocs makes use of for generating [social cards] and performing === ":fontawesome-brands-windows: Windows" As stated in the [installation guide], the easiest way to get up and running - with the [Cairo Graphics] library on Windows is by installing [GTK+], since - it has Cairo as a dependency. You can also download and install a - precompiled [GTK runtime]. + with the [Cairo Graphics] library on Windows is by installing [GTK+]. You + can also download a precompiled [GTK runtime]. === ":material-linux: Linux" @@ -70,8 +86,6 @@ The following environments come with a preinstalled version of [Cairo Graphics]: - [x] No installation needed in [GitHub Actions] (Ubuntu) [Cairo Graphics]: https://www.cairographics.org/ - [Pillow]: https://pillow.readthedocs.io/ - [CairoSVG]: https://cairosvg.org/ [Homebrew]: https://brew.sh/ [installation guide]: https://www.cairographics.org/download/ [GTK+]: https://www.gtk.org/docs/installations/windows/ @@ -82,7 +96,7 @@ The following environments come with a preinstalled version of [Cairo Graphics]: ### pngquant [pngquant] is an excellent library for lossy PNG compression, and a direct -dependency of the [built-in optimize plugin]. See the following section which +dependency of the [built-in optimize plugin]. See the following section which explains how to install [pngquant] system: === ":material-apple: macOS" @@ -97,8 +111,8 @@ explains how to install [pngquant] system: === ":fontawesome-brands-windows: Windows" - Installing [pngquant] on Windows is a little more involved. The - [pngquant-winbuild] repository contains a guide on how to set up an + Installing [pngquant] on Windows is a little more involved. The + [pngquant-winbuild] repository contains a guide on how to set up an environment for building [pngquant] on Windows. === ":material-linux: Linux" @@ -113,6 +127,10 @@ explains how to install [pngquant] system: The same is true for `yum` and `zypper`. +The following environments come with a preinstalled version of [pngquant]: + +- [x] No installation needed in [Docker image] + [pngquant]: https://pngquant.org/ - [built-in optimize plugin]: ../building-an-optimized-site.md#built-in-optimize-plugin + [built-in optimize plugin]: ../../plugins/optimize.md [pngquant-winbuild]: https://github.com/jibsen/pngquant-winbuild diff --git a/docs/plugins/search.md b/docs/plugins/search.md new file mode 100644 index 000000000..517b2b128 --- /dev/null +++ b/docs/plugins/search.md @@ -0,0 +1,427 @@ +--- +title: Built-in search plugin +icon: material/magnify +--- + +# Built-in search plugin + +The search plugin adds a search bar to the header, allowing users to search your +documentation. It's powered by [lunr.js], a lightweight full-text search engine +for the browser, elimininating the need for external services, and even works +when building [offline-capable documentation]. + + [lunr.js]: https://lunrjs.com/ + [offline-capable documentation]: ../setup/building-for-offline-usage.md + +## Objective + +### How it works + +The plugin scans the generated HTML and builds a search index from all pages and +sections by extracting the section titles and contents. It preserves some inline +formatting like code blocks and lists, but removes all other formatting, so the +search index is as small as possible. + +When a user visits your site, the search index is shipped to the browser, +indexed with [lunr.js] and made available for fast and simple querying – no +server needed. This ensures that the search index is always up to date with +your documentation, yielding accurate results. + +### When to use it + +It's generally recommended to use the plugin, as interactive search functionality +is a vital part of every good documentation. Additionally, the plugin integrates +perfectly with several of the other [built-in plugins] that Material for MkDocs +offers: + +
+ +- :material-connection:   __[Built-in offline plugin][offline]__ + + --- + + The offline plugin adds support for building offline-capable documentation, + so you can distribute the [`site` directory][mkdocs.site_dir] as a `.zip` + file that can be downloaded. + + --- + + __Your documentation can work without connectivity to the internet__ + +- :material-file-tree:   __[Built-in meta plugin][meta]__ + + --- + + The meta plugin makes it easy to [boost][meta.search.boost] specific + sections in search results or to [exclude][meta.search.exclude] them + entirely from being indexed, giving more granular control over search. + + --- + + __Simpler organization and management of search in different subsections__ + +
+ + [offline]: offline.md + [meta]: meta.md + [built-in plugins]: index.md + +## Configuration + + + + +As with all [built-in plugins], getting started with the search plugin is +straightforward. Just add the following lines to `mkdocs.yml`, and your users +will be able to search your documentation: + +``` yaml +plugins: + - search +``` + +The search plugin is built into Material for MkDocs and doesn't need to be +installed. + + [search]: search.md + [built-in plugins]: index.md + +### General + +The following settings are available: + +--- + +#### + + + + +Use this setting to enable or disable the plugin when [building your project]. +It's normally not necessary to specify this setting, but if you want to disable +the plugin, use: + +``` yaml +plugins: + - search: + enabled: false +``` + + [building your project]: ../creating-your-site.md#building-your-site + +### Search + +The following settings are available for search: + +--- + +#### + + + + +Use this setting to specify the language of the search index, enabling [stemming] +support for other languages than English. The default value is automatically +computed from the [site language], but can be explicitly set to another language +or even multiple languages with: + +=== "Set language" + + ``` yaml + plugins: + - search: + lang: en + ``` + +=== "Add further languages" + + ``` yaml + plugins: + - search: + lang: # (1)! + - en + - de + ``` + + 1. Be aware that including support for further languages increases the + base JavaScript payload by around 20kb and by another 15-30kb per + language, all before `gzip`. + + [stemming]: https://en.wikipedia.org/wiki/Stemming + [site language]: ../setup/changing-the-language.md#site-language + [lunr languages]: https://github.com/MihaiValentin/lunr-languages + +Language support is provided by [lunr languages], a collection of +language-specific stemmers and stop words for [lunr.js] maintained by the +Open Source community. + +--- + +The following languages are currently supported by [lunr languages]: + +
+ +- `ar` – Arabic +- `da` – Danish +- `de` – German +- `du` – Dutch +- `en` – English +- `es` – Spanish +- `fi` – Finnish +- `fr` – French +- `hi` – Hindi +- `hu` – Hungarian +- `hy` – Armenian +- `it` – Italian +- `ja` – Japanese +- `kn` - Kannada +- `ko` – Korean +- `no` – Norwegian +- `pt` – Portuguese +- `ro` – Romanian +- `ru` – Russian +- `sa` – Sanskrit +- `sv` – Swedish +- `ta` – Tamil +- `te` – Telugu +- `th` – Thai +- `tr` – Turkish +- `vi` – Vietnamese +- `zh` – Chinese + +
+ +If [lunr languages] doesn't provide support for the selected [site language], +the plugin falls back to another language that yields the best stemming results. +If you discover that the search results are not satisfactory, you can contribute +to [lunr languages] by adding support for your language. + +--- + +#### + + + + +Use this setting to specify the separator used to split words when building the +search index on the client side. The default value is automatically computed +from the [site language], but can also be explicitly set to another value with: + +``` yaml +plugins: + - search: + separator: '[\s\-,:!=\[\]()"/]+|(?!\b)(?=[A-Z][a-z])|\.(?!\d)|&[lg]t;' +``` + +Separators support [positive and negative lookahead assertions], which allows +for rather complex expressions that yield precise control over how words are +split when building the search index. + +Broken into its parts, this separator induces the following behavior: + +=== "Special characters" + + ``` + [\s\-,:!=\[\]()"/]+ + ``` + + The first part of the expression inserts token boundaries for each + document before and after whitespace, hyphens, commas, brackets and + other special characters. If several of those special characters are + adjacent, they are treated as one. + +=== "Case changes" + + ``` + (?!\b)(?=[A-Z][a-z]) + ``` + + Many programming languages have naming conventions like `PascalCase` or + `camelCase`. By adding this subexpression to the separator, + [words are split at case changes], tokenizing the word `PascalCase` + into `Pascal` and `Case`. + +=== "Version strings" + + ``` + \.(?!\d) + ``` + + When adding `.` to the separator, version strings like `1.2.3` are split + into `1`, `2` and `3`, which makes them undiscoverable via search. When + using this subexpression, a small lookahead is introduced which will + [preserve version strings] and keep them discoverable. + +=== "HTML/XML tags" + + ``` + &[lg]t; + ``` + + If your documentation includes HTML/XML code examples, you may want to allow + users to find [specific tag names]. Unfortunately, the `<` and `>` control + characters are encoded in code blocks as `<` and `>`. Adding this + subexpression to the separator allows for just that. + + [positive and negative lookahead assertions]: https://www.regular-expressions.info/lookaround.html + [words are split at case changes]: ?q=searchHighlight + [preserve version strings]: ?q=9.0.0 + [specific tag names]: ?q=script + +--- + +#### + + + + + +Use this setting to specify the [pipeline functions] that are used to filter and +expand tokens after tokenizing them with the [`separator`][config.separator] and +before adding them to the search index. The default value is automatically +computed from the [site language], but can also be explicitly set with: + +``` yaml +plugins: + - search: + pipeline: + - stemmer + - stopWordFilter + - trimmer +``` + +The following pipeline functions can be used: + +- `stemmer` – Stem tokens to their root form, e.g. `running` to `run` +- `stopWordFilter` – Filter common words according, e.g. `a`, `the`, etc. +- `trimmer` – Trim whitespace from tokens + + [pipeline functions]: https://lunrjs.com/guides/customising.html#pipeline-functions + +### Segmentation + +The plugin supports text segmentation of Chinese via [jieba], a popular +Chinese text segmentation library. Other languages like Japanese and Korean are +currently segmented on the client side, but we're considering to move this +functionality into the plugin in the future. + +The following settings are available for segmentation: + + [jieba]: https://pypi.org/project/jieba/ + +--- + +#### + + + + + +Use this setting to specify a [custom dictionary] to be used by [jieba] for +segmenting text, replacing the default dictionary. [jieba] comes with +several dictionaries, which can be used with: + +``` yaml +plugins: + - search: + jieba_dict: dict.txt +``` + +The following dictionaries are provided by [jieba]: + +- [dict.txt.small] – 占用内存较小的词典文件 +- [dict.txt.big] – 支持繁体分词更好的词典文件 + +The provided path is resolved from the root directory. + + [custom dictionary]: https://github.com/fxsjy/jieba#%E5%85%B6%E4%BB%96%E8%AF%8D%E5%85%B8 + [dict.txt.small]: https://github.com/fxsjy/jieba/raw/master/extra_dict/dict.txt.small + [dict.txt.big]: https://github.com/fxsjy/jieba/raw/master/extra_dict/dict.txt.big + +--- + +#### + + + + + +Use this setting to specify an additional [user dictionary] to be used by +[jieba] for segmenting text, augmenting the default dictionary. User +dictionaries are ideal for tuning the segmenter: + +``` yaml +plugins: + - search: + jieba_dict_user: user_dict.txt +``` + +The provided path is resolved from the root directory. + + [user dictionary]: https://github.com/fxsjy/jieba#%E8%BD%BD%E5%85%A5%E8%AF%8D%E5%85%B8 + +## Usage + +### Metadata + +The following properties are available: + +--- + +#### + + + + + +Use this property to increase or decrease the relevance of a page in the search +results, giving more weight to them. Use values above `1` to rank up and values +below `1` to rank down: + +=== ":material-arrow-up-circle: Rank up" + + ``` yaml + --- + search: + boost: 2 # (1)! + --- + + # Page title + ... + ``` + + 1. When boosting pages, always start with low values. + +=== ":material-arrow-down-circle: Rank down" + + ``` yaml + --- + search: + boost: 0.5 + --- + + # Page title + ... + ``` + +--- + +#### + + + + + +Use this property to exclude a page from the search results. Note that this will +not only remove the page, but also all subsections of the page from the search +results: + +``` yaml +--- +search: + exclude: true +--- + +# Page title +... +``` diff --git a/docs/plugins/social.md b/docs/plugins/social.md new file mode 100644 index 000000000..6093b8351 --- /dev/null +++ b/docs/plugins/social.md @@ -0,0 +1,1059 @@ +--- +title: Built-in social plugin +icon: material/share-circle +--- + +# Built-in social plugin + +The social plugin automatically and intelligently generates beautiful and highly +customizable social cards in different [layouts][default layouts] for each page +of your project, rendering as preview images whenever you or somebody else share +a link to your project on social media. + +## Objective + +### How it works + +The plugin automatically generates a customizable social card for each page +of your project, which appears as a preview image when sharing a link to your +project on social media, without the use of external services and just +[a single line of configuration][configuration]. + +With the use of an efficient [image processing] library, the plugin allows to +define [custom layouts] for social cards, which can be adapted to match your +project's style and branding. While it would technically be much simpler to +generate social cards by using a web browser and an automation framework like +[Puppeteer][^1], it would add further liabilities to your toolchain, with the +potential to make build pipelines more complex, much more resource intense, +and significantly slower. + + [^1]: + [GitHub wrote in their blog] that they use [Puppeteer] to generate social + card images for repositories, issues, commits, discussions, and basically + everything else that appear as preview images when shared on social media. + +The generated social cards are [cached] and stored in the +[`site` directory][mkdocs.site_dir], and thus self-hosted, ensuring that your +project doesn't depend on external services. In order to generate social cards +images, a few [dependencies] need to be available on your system. + + [configuration]: #configuration + [image processing]: requirements/image-processing.md + [custom layouts]: ../setup/setting-up-social-cards.md#customization + [Puppeteer]: https://github.com/puppeteer/puppeteer + [GitHub wrote in their blog]: https://github.blog/2021-06-22-framework-building-open-graph-images/ + [cached]: #caching + [dependencies]: #configuration + +### When to use it + +There's one particular case when we don't recommend to use the plugin: when you +build [offline-capable documentation] to offer it as a download. Otherwise, it +always makes sense to enable the plugin, as links to your documentation shared +on social media will appear much more appealing. + +Even more interestingly, the plugin can be combined with other built-in plugins +that Material for MkDocs offers, in order to create sophisticated build +pipelines tailored to your project: + +
+ +- :material-newspaper-variant-outline:   __[Built-in blog plugin][blog]__ + + --- + + The social plugin automatically generates beautiful and customizable + social cards for each post and page, showing as previews on social media. + + --- + + __Links to your blog render beautiful social cards when shared on social media__ + +- :material-file-tree:   __[Built-in meta plugin][meta]__ + + --- + + The meta plugin can be used to [change the layout][meta.social.cards_layout] + for social cards or [change specific layout options] + [meta.social.cards_layout_options] like [background][option.background_color] + or [color][option.color] for a subset of pages. + + --- + + __Your documentation can use completely different social cards per section__ + +
+ + [offline-capable documentation]: ../setup/building-for-offline-usage.md + [blog]: blog.md + [meta]: meta.md + +## Configuration + + + + + + +In order to get started with the social plugin, just add the following lines to +`mkdocs.yml`, and observe how Material for MkDocs generates beautiful social +cards for you: + +``` yaml +plugins: + - social +``` + +The social plugin is built into Material for MkDocs and doesn't need to be +installed. + +However, in order to generate social card images, it's necessary to install the +dependencies for [image processing], if they're not already available on your +system. The linked guide includes instructions for several operating systems +and mentions some alternative environments. + + [social]: social.md + +### General + +The following settings are available: + +--- + +#### + + + + +Use this setting to enable or disable the plugin when [building your project]. +If you want to disable the plugin, e.g., for local builds, you can use an +[environment variable][mkdocs.env] in `mkdocs.yml`: + +``` yaml +plugins: + - social: + enabled: !ENV [CI, false] +``` + +This configuration enables the plugin only during continuous integration (CI). + + [building your project]: ../creating-your-site.md#building-your-site + +--- + +#### + + + + + +With more CPUs available, the plugin can do more work in parallel, and thus +complete social card generation faster. If you want to disable concurrent +processing completely, use: + +``` yaml +plugins: + - social: + concurrency: 1 +``` + +By default, the plugin uses all available CPUs - 1 with a minimum of 1. + +### Caching + +The plugin implements an [intelligent caching] mechanism, ensuring that social +cards are only regenerated when their contents change or they're not already +contained in the cache. If any of the variables used in a layout changes, the +plugin detects it and regenerates the social card. + +The following settings are available for caching: + + [intelligent caching]: requirements/caching.md + +--- + +#### + + + + + +Use this setting to instruct the plugin to bypass the cache, in order to +re-generate social cards for all pages, even though the cache may not be stale. +It's normally not necessary to specify this setting, except for when debugging +the plugin itself. Caching can be disabled with: + +``` yaml +plugins: + - social: + cache: false +``` + +--- + +#### + + + + +It is normally not necessary to specify this setting, except for when you want +to change the path within your root directory where social card images are +cached. If you want to change it, use: + +``` yaml +plugins: + - social: + cache_dir: my/custom/dir +``` + +If you're using [multiple instances] of the plugin, it can be a good idea to +set different cache directories for both instances, so that they don't interfere +with each other. + + [multiple instances]: index.md#multiple-instances + +### Logging + +The following settings are available for logging: + +--- + +#### + + + + + +Use this setting to control whether the plugin should only log errors when +generating social cards without terminating the build, e.g., invalid references +to icons. To terminate the build, use: + +``` yaml +plugins: + - social: + log: false +``` + +--- + +#### + + + + + +Use this setting to control the log level that the plugin should employ when +encountering errors, which requires that the [`log`][config.log] setting is +enabled. The following log levels are available: + +=== "`warn`" + + ``` yaml + plugins: + - social: + log_level: warn + ``` + + Errors are reported as warnings, terminating the build in + [`strict`][mkdocs.strict] mode. + +=== "`info`" + + ``` yaml + plugins: + - social: + log_level: info + ``` + + Errors are only reported as informational messages. + +=== "`ignore`" + + ``` yaml + plugins: + - social: + log_level: ignore + ``` + + Errors are only reported when using the `--verbose` flag. + + +### Social cards + +The following settings are available for social card generation: + +--- + +#### + + + + +Use this setting to enable or disable social card generation. Currently, the +plugin's sole purpose is to generate social cards, so it's equivalent to the +[`enabled`][config.enabled] setting, but in the future, other features might be +added. If you want to disable social card generation, use: + +``` yaml +plugins: + - social: + cards: false +``` + +--- + +#### + + + + +It is normally not necessary to specify this setting, except for when you want +to change the path within the [`site` directory][mkdocs.site_dir] where +social cards are stored. If you want to change it, use: + +``` yaml +plugins: + - social: + cards_dir: my/custom/dir +``` + +This configuration stores the generated images at `my/custom/dir` in the +[`site` directory][mkdocs.site_dir]. + +--- + +#### + + + + + +If you want to build a [custom social card layout][custom layouts], use this +setting to change the folder where you store your custom layouts, the default +being a folder called `layouts` in your root directory: + +``` yaml +plugins: + - social: + cards_layout_dir: layouts +``` + +The provided path is resolved from the root directory. + +!!! tip "Where to store custom layouts" + + Our recommendation is to locate the folder outside of the + [`docs` directory][mkdocs.docs_dir], to make sure that your [custom layouts] + are not copied to the [`site` directory][mkdocs.site_dir] when + [building your project], e.g., by adhering to the following directory + layout: + + ``` { .sh .no-copy } + . + ├─ docs/ + │ └─ *.md + ├─ layouts/ + │ └─ *.yml + └─ mkdocs.yml + ``` + +--- + +#### + + + + + +The plugin ships a growing list of [`default` layouts][default layouts] for +social cards. If you've created a [custom social card layout][custom layouts], +you can instruct the plugin to use it exactly as one of the included layouts: + +``` yaml +plugins: + - social: + cards_layout: my-custom-layout +``` + +The provided path is resolved from the[ +`layouts` directory][config.cards_layout_dir]. + +!!! tip "How custom layouts are resolved" + + By default, the plugin will load your [custom layouts] from a folder named + `layouts` in your root directory. If your layout is called + `my-custom-layout`, the directory layout must adhere to: + + ``` { .sh .no-copy } + . + ├─ docs/ + │ └─ *.md + ├─ layouts/ + │ └─ my-custom-layout.yml + └─ mkdocs.yml + ``` + +--- + +#### + + + + +Use this setting to set options for the layout specified via [`cards_layout`] +[config.cards_layout] (if the layout supports it), which allows for making +layouts easily and entirely configurable: + +``` yaml +plugins: + - social: + cards_layout_options: +