Documentation

This commit is contained in:
squidfunk 2022-10-02 17:34:23 +02:00
parent f139b54c61
commit 270f372309
3 changed files with 53 additions and 5 deletions

View File

@ -51,9 +51,27 @@ You can copy the link of the tab and create a link on the same or any other
page. For example, you can [jump to the third tab above this paragraph][tab_1]
or to the [publishing guide for Insiders][tab_2].
!!! tip "Readable anchor links"
[Python Markdown Extensions] 9.6 adds support for [slugification] of
content tabs, which produces nicer looking and more readable anchor links.
Enable the slugify function with the following lines:
``` yaml
markdown_extensions:
- pymdownx.tabbed:
slugify: !!python/object/apply:pymdownx.slugs.slugify
kwds:
case: lower
```
Fore more information, please [see the extension guide][slugification].
[Insiders]: ../insiders/index.md
[tab_1]: #__tabbed_1_3
[tab_2]: ../publishing-your-site.md#__tabbed_1_2
[tab_1]: #-or-even-me
[tab_2]: ../publishing-your-site.md#insiders
[Python Markdown Extensions]: https://facelessuser.github.io/pymdown-extensions/
[slugification]: ../setup/extensions/python-markdown-extensions.md#+pymdownx.tabbed.slugify
### Linked content tabs

View File

@ -540,12 +540,16 @@
"type": "object",
"properties": {
"alternate_style": {
"markdownDescription": "https://squidfunk.github.io/mkdocs-material/setup/extensions/python-markdown-extensions/#tabbed-alternate-style",
"markdownDescription": "https://squidfunk.github.io/mkdocs-material/setup/extensions/python-markdown-extensions/#+pymdownx.tabbed.alternate_style",
"type": "boolean",
"enum": [
true
],
"default": true
},
"slugify": {
"markdownDescription": "https://squidfunk.github.io/mkdocs-material/setup/extensions/python-markdown-extensions/#+pymdownx.tabbed.slugify",
"default": "!!python/object/apply:pymdownx.slugs.slugify {kwds: {case: lower}}"
}
},
"additionalProperties": false,

View File

@ -660,6 +660,31 @@ The following configuration options are supported:
alternate_style: true
```
[`slugify`](#+pymdownx.tabbed.slugify){ #+pymdownx.tabbed.slugify }
: :octicons-milestone-24: Default: `headerid.slugify` This option allows for
customization of the slug function. For some languages, the default may not
produce good and readable identifiers consider using another slug function
like for example those from [Python Markdown Extensions][Slugs]:
=== "Unicode"
``` yaml
markdown_extensions:
- pymdownx.tabbed:
slugify: !!python/object/apply:pymdownx.slugs.slugify
kwds:
case: lower
```
=== "Unicode, case-sensitive"
``` yaml
markdown_extensions:
- pymdownx.tabbed:
slugify: !!python/object/apply:pymdownx.slugs.slugify
```
The other configuration options of this extension are not officially supported
by Material for MkDocs, which is why they may yield unexpected results. Use
them at your own risk.
@ -678,6 +703,7 @@ See reference for usage:
[Grouping code blocks]: ../../reference/content-tabs.md#grouping-code-blocks
[Grouping other content]: ../../reference/content-tabs.md#grouping-other-content
[Embedded content]: ../../reference/content-tabs.md#embedded-content
[Slugs]: https://facelessuser.github.io/pymdown-extensions/extras/slugs/
### Tasklist