From c0e8d062b907288da454856f4a161e0ea84a5de4 Mon Sep 17 00:00:00 2001 From: squidfunk Date: Fri, 17 Jul 2020 14:33:52 +0200 Subject: [PATCH] Added customization guide for languages --- docs/guides/changing-the-fonts.md | 11 ++++++----- docs/guides/changing-the-language.md | 23 +++++++++++++++++++++++ docs/guides/navigation.md | 16 ++++------------ 3 files changed, 33 insertions(+), 17 deletions(-) diff --git a/docs/guides/changing-the-fonts.md b/docs/guides/changing-the-fonts.md index 57d2293c9..84a3f3624 100644 --- a/docs/guides/changing-the-fonts.md +++ b/docs/guides/changing-the-fonts.md @@ -64,9 +64,9 @@ theme: This will prevent typefaces from being loaded from Google Fonts. As a fallback, common system fonts will be used automatically. Additionally, if you want to -load a font from another destination, you can either [override the `fonts` -block][6] with a `style` tag, or use an [additional stylesheet][7] to add the -necessary `@font-face` definition: +load a font from another destination, you may either follow the guide on [theme +extension][6] and [override the `fonts` block][7] with a `style` tag, or use an +[additional stylesheet][8] to add the necessary `@font-face` definition: ``` css @font-face { @@ -94,5 +94,6 @@ The font can then be configured to be used as the regular or proportional font: ``` [5]: ../data-privacy.md - [6]: ../customization.md#overriding-blocks - [7]: ../customization.md#additional-stylesheets + [6]: ../customization.md#setup-and-theme-structure + [7]: ../customization.md#overriding-blocks + [8]: ../customization.md#additional-stylesheets diff --git a/docs/guides/changing-the-language.md b/docs/guides/changing-the-language.md index 83a151318..f2a337c06 100644 --- a/docs/guides/changing-the-language.md +++ b/docs/guides/changing-the-language.md @@ -150,3 +150,26 @@ directionality: [5]: https://github.com/squidfunk/mkdocs-material/blob/master/src/base.html#L168 + +## Customization + +If you want to customize some (or all) of the translations for your language, +you may follow the guide on [theme extension][6] and create a new partial in +`partials/language`, e.g. `en-custom.html`. Next, look up the translation you +want to change in the [base translation][1] and add it to the partial you just +created. Say, you want to change "__Table of contents__" to "__On this page__": + +``` jinja +{% macro t(key) %}{{ { + "toc.title": "On this page" +}[key] }}{% endmacro %} +``` + +Then, add the following lines to `mkdocs.yml`: + +``` yaml +theme: + language: en-custom +``` + + [6]: ../customization.md#setup-and-theme-structure diff --git a/docs/guides/navigation.md b/docs/guides/navigation.md index 1ceda1c51..bfd8d10c6 100644 --- a/docs/guides/navigation.md +++ b/docs/guides/navigation.md @@ -93,13 +93,13 @@ used to render these pages. [:octicons-file-code-24: Source][5] · [:octicons-workflow-24: Extension][6] -The [Table of Contents][7] extension, which is part of the standard Markdown +The [table of contents][7] extension, which is part of the standard Markdown library, provides some options that are supported by Material for MkDocs to -customize its appearance. +customize its appearance: `permalink` -: This options adds an anchor link containing the paragraph symbol `¶` or +: This option adds an anchor link containing the paragraph symbol `¶` or another custom symbol at the end of each headline, exactly like on the page you're currently viewing, which Material for MkDocs will make appear on hover: @@ -120,14 +120,6 @@ customize its appearance. permalink: ⚓︎ ``` - === "Link" - - ``` yaml - markdown_extensions: - - toc: - permalink: Link - ``` - `slugify` : This option allows for customization of the slug function. For some @@ -143,7 +135,7 @@ customize its appearance. slugify: pymdownx.slugs.uslugify ``` - === "Casing" + === "Unicode, case-sensitive" ``` yaml markdown_extensions: