Added customization guide for languages

This commit is contained in:
squidfunk 2020-07-17 14:33:52 +02:00
parent 8443720155
commit c0e8d062b9
3 changed files with 33 additions and 17 deletions

View File

@ -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

View File

@ -150,3 +150,26 @@ directionality:
</script>
[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

View File

@ -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: