diff --git a/docs/reference/content-tabs.md b/docs/reference/content-tabs.md index 180ca6a87..7e15ecf9d 100644 --- a/docs/reference/content-tabs.md +++ b/docs/reference/content-tabs.md @@ -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 diff --git a/docs/schema/extensions/pymdownx.json b/docs/schema/extensions/pymdownx.json index c0560d83c..19b2e5e7b 100644 --- a/docs/schema/extensions/pymdownx.json +++ b/docs/schema/extensions/pymdownx.json @@ -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, diff --git a/docs/setup/extensions/python-markdown-extensions.md b/docs/setup/extensions/python-markdown-extensions.md index fb403a1f0..c32c410b0 100644 --- a/docs/setup/extensions/python-markdown-extensions.md +++ b/docs/setup/extensions/python-markdown-extensions.md @@ -642,7 +642,7 @@ related content and code blocks under accessible tabs. Enable it via ``` yaml markdown_extensions: - pymdownx.tabbed: - alternate_style: true + alternate_style: true ``` The following configuration options are supported: @@ -657,9 +657,34 @@ The following configuration options are supported: ``` yaml markdown_extensions: - pymdownx.tabbed: - alternate_style: true + 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