From 294d38e8d306fafdfa78a2dfe74ed80c7e075a4a Mon Sep 17 00:00:00 2001 From: squidfunk Date: Sun, 28 Jan 2024 15:51:25 +0700 Subject: [PATCH] Documentation --- docs/reference/admonitions.md | 6 +++--- docs/reference/annotations.md | 6 +++--- docs/reference/buttons.md | 4 ++-- docs/reference/code-blocks.md | 8 ++++---- docs/reference/content-tabs.md | 4 ++-- docs/reference/data-tables.md | 2 +- docs/reference/footnotes.md | 2 +- docs/reference/formatting.md | 18 +++++++++--------- docs/reference/grids.md | 4 ++-- docs/reference/images.md | 4 ++-- docs/reference/lists.md | 6 +++--- docs/reference/tooltips.md | 6 +++--- material/overrides/hooks/shortcodes.py | 1 + src/overrides/hooks/shortcodes.py | 1 + 14 files changed, 37 insertions(+), 35 deletions(-) diff --git a/docs/reference/admonitions.md b/docs/reference/admonitions.md index 0bcf9e863..03b163567 100644 --- a/docs/reference/admonitions.md +++ b/docs/reference/admonitions.md @@ -24,9 +24,9 @@ markdown_extensions: See additional configuration options: -- [Admonition] -- [Details] -- [SuperFences] +- [Admonition]{ data-preview="" } +- [Details]{ data-preview="" } +- [SuperFences]{ data-preview="" } [Admonition]: ../setup/extensions/python-markdown.md#admonition [Details]: ../setup/extensions/python-markdown-extensions.md#details diff --git a/docs/reference/annotations.md b/docs/reference/annotations.md index 2ee13c12b..3f428a12b 100644 --- a/docs/reference/annotations.md +++ b/docs/reference/annotations.md @@ -23,9 +23,9 @@ markdown_extensions: See additional configuration options: -- [Attribute Lists] -- [Markdown in HTML] -- [SuperFences] +- [Attribute Lists]{ data-preview="" } +- [Markdown in HTML]{ data-preview="" } +- [SuperFences]{ data-preview="" } [Attribute Lists]: ../setup/extensions/python-markdown.md#attribute-lists [Markdown in HTML]: ../setup/extensions/python-markdown.md#markdown-in-html diff --git a/docs/reference/buttons.md b/docs/reference/buttons.md index 963c70e1b..83735c68f 100644 --- a/docs/reference/buttons.md +++ b/docs/reference/buttons.md @@ -21,7 +21,7 @@ markdown_extensions: See additional configuration options: -- [Attribute Lists] +- [Attribute Lists]{ data-preview="" } [Attribute Lists]: ../setup/extensions/python-markdown.md#attribute-lists @@ -44,7 +44,7 @@ In order to render a link as a button, suffix it with curly braces and add the [primary color]: ../setup/changing-the-colors.md#primary-color - [accent color]: ../setup/changing-the-colors.md#accent-color + [accent color]: ../setup/changing-the-colors.md#accent-color [Demo]: javascript:alert$.next("Demo") ### Adding primary buttons diff --git a/docs/reference/code-blocks.md b/docs/reference/code-blocks.md index 4ac278ad8..10756bc69 100644 --- a/docs/reference/code-blocks.md +++ b/docs/reference/code-blocks.md @@ -34,10 +34,10 @@ JavaScript syntax highlighter. See additional configuration options: -- [Highlight] -- [InlineHilite] -- [SuperFences] -- [Snippets] +- [Highlight]{ data-preview="" } +- [InlineHilite]{ data-preview="" } +- [SuperFences]{ data-preview="" } +- [Snippets]{ data-preview="" } [Highlight]: ../setup/extensions/python-markdown-extensions.md#highlight [InlineHilite]: ../setup/extensions/python-markdown-extensions.md#inlinehilite diff --git a/docs/reference/content-tabs.md b/docs/reference/content-tabs.md index ded76bea1..f16e990aa 100644 --- a/docs/reference/content-tabs.md +++ b/docs/reference/content-tabs.md @@ -24,8 +24,8 @@ markdown_extensions: See additional configuration options: -- [SuperFences] -- [Tabbed] +- [SuperFences]{ data-preview="" } +- [Tabbed]{ data-preview="" } [SuperFences]: ../setup/extensions/python-markdown-extensions.md#superfences [Tabbed]: ../setup/extensions/python-markdown-extensions.md#tabbed diff --git a/docs/reference/data-tables.md b/docs/reference/data-tables.md index fd2db1bf1..31cb4dff6 100644 --- a/docs/reference/data-tables.md +++ b/docs/reference/data-tables.md @@ -24,7 +24,7 @@ markdown_extensions: See additional configuration options: -- [Tables] +- [Tables]{ data-preview="" } [Tables]: ../setup/extensions/python-markdown.md#tables diff --git a/docs/reference/footnotes.md b/docs/reference/footnotes.md index 1a2ec5ca3..7e703094c 100644 --- a/docs/reference/footnotes.md +++ b/docs/reference/footnotes.md @@ -22,7 +22,7 @@ markdown_extensions: See additional configuration options: -- [Footnotes] +- [Footnotes]{ data-preview="" } [Footnotes]: ../setup/extensions/python-markdown.md#footnotes diff --git a/docs/reference/formatting.md b/docs/reference/formatting.md index d1e0c9a23..09bb73c77 100644 --- a/docs/reference/formatting.md +++ b/docs/reference/formatting.md @@ -4,8 +4,8 @@ icon: material/format-font # Formatting -Material for MkDocs provides support for several HTML elements that can be used -to highlight sections of a document or apply specific formatting. Additionally, +Material for MkDocs provides support for several HTML elements that can be used +to highlight sections of a document or apply specific formatting. Additionally, [Critic Markup] is supported, adding the ability to display suggested changes for a document. @@ -14,7 +14,7 @@ for a document. ## Configuration This configuration enables support for keyboard keys, tracking changes in -documents, defining sub- and superscript and highlighting text. Add the +documents, defining sub- and superscript and highlighting text. Add the following lines to `mkdocs.yml`: ``` yaml @@ -28,9 +28,9 @@ markdown_extensions: See additional configuration options: -- [Critic] -- [Caret, Mark & Tilde] -- [Keys] +- [Critic]{ data-preview="" } +- [Caret, Mark & Tilde]{ data-preview="" } +- [Keys]{ data-preview="" } [Critic]: ../setup/extensions/python-markdown-extensions.md#critic [Caret, Mark & Tilde]: ../setup/extensions/python-markdown-extensions.md#caret-mark-tilde @@ -40,7 +40,7 @@ See additional configuration options: ### Highlighting changes -When [Critic] is enabled, [Critic Markup] can be used, which adds the ability to +When [Critic] is enabled, [Critic Markup] can be used, which adds the ability to highlight suggested changes, as well as add inline comments to a document: ``` title="Text with suggested changes" @@ -78,7 +78,7 @@ Text can be deleted and replacement text ### Highlighting text -When [Caret, Mark & Tilde] are enabled, text can be highlighted with a simple +When [Caret, Mark & Tilde] are enabled, text can be highlighted with a simple syntax, which is more convenient that directly using the corresponding [`mark`][mark], [`ins`][ins] and [`del`][del] HTML tags: @@ -102,7 +102,7 @@ syntax, which is more convenient that directly using the corresponding ### Sub- and superscripts -When [Caret & Tilde][Caret, Mark & Tilde] are enabled, text can be sub- and +When [Caret & Tilde][Caret, Mark & Tilde] are enabled, text can be sub- and superscripted with a simple syntax, which is more convenient than directly using the corresponding [`sub`][sub] and [`sup`][sup] HTML tags: diff --git a/docs/reference/grids.md b/docs/reference/grids.md index 10af8d55b..9596808b4 100644 --- a/docs/reference/grids.md +++ b/docs/reference/grids.md @@ -26,8 +26,8 @@ markdown_extensions: # (1)! See additional configuration options: -- [Attribute Lists] -- [Markdown in HTML] +- [Attribute Lists]{ data-preview="" } +- [Markdown in HTML]{ data-preview="" } [icons and emojis]: icons-emojis.md [configured separately]: icons-emojis.md#configuration diff --git a/docs/reference/images.md b/docs/reference/images.md index a9009258d..259db8330 100644 --- a/docs/reference/images.md +++ b/docs/reference/images.md @@ -23,8 +23,8 @@ markdown_extensions: See additional configuration options: -- [Attribute Lists] -- [Markdown in HTML] +- [Attribute Lists]{ data-preview="" } +- [Markdown in HTML]{ data-preview="" } [Attribute Lists]: ../setup/extensions/python-markdown.md#attribute-lists [Markdown in HTML]: ../setup/extensions/python-markdown.md#markdown-in-html diff --git a/docs/reference/lists.md b/docs/reference/lists.md index 5883002a7..ac9774b0b 100644 --- a/docs/reference/lists.md +++ b/docs/reference/lists.md @@ -24,8 +24,8 @@ markdown_extensions: See additional configuration options: -- [Definition Lists] -- [Tasklist] +- [Definition Lists]{ data-preview="" } +- [Tasklist]{ data-preview="" } [Definition Lists]: ../setup/extensions/python-markdown.md#definition-lists [Tasklist]: ../setup/extensions/python-markdown-extensions.md#tasklist @@ -62,7 +62,7 @@ of lists can be nested inside each other: ### Using ordered lists -Ordered lists must start with a number immediately followed by a dot. The +Ordered lists must start with a number immediately followed by a dot. The numbers do not need to be consecutive and can be all set to `1.`, as they will be re-numbered when rendered: diff --git a/docs/reference/tooltips.md b/docs/reference/tooltips.md index 4f89c2991..f239d13f8 100644 --- a/docs/reference/tooltips.md +++ b/docs/reference/tooltips.md @@ -25,9 +25,9 @@ markdown_extensions: See additional configuration options: -- [Abbreviations] -- [Attribute Lists] -- [Snippets] +- [Abbreviations]{ data-preview="" } +- [Attribute Lists]{ data-preview="" } +- [Snippets]{ data-preview="" } [Abbreviations]: ../setup/extensions/python-markdown.md#abbreviations [Attribute Lists]: ../setup/extensions/python-markdown.md#attribute-lists diff --git a/material/overrides/hooks/shortcodes.py b/material/overrides/hooks/shortcodes.py index faba23323..eb4437a50 100644 --- a/material/overrides/hooks/shortcodes.py +++ b/material/overrides/hooks/shortcodes.py @@ -113,6 +113,7 @@ def _resolve(file: File, page: Page): # Create badge def _badge(icon: str, text: str = "", type: str = ""): classes = f"mdx-badge mdx-badge--{type}" if type else "mdx-badge" + text = f"{text}{{ data-preview='' }}" if text.endswith(")") else text return "".join([ f"", *([f"{icon}"] if icon else []), diff --git a/src/overrides/hooks/shortcodes.py b/src/overrides/hooks/shortcodes.py index faba23323..eb4437a50 100644 --- a/src/overrides/hooks/shortcodes.py +++ b/src/overrides/hooks/shortcodes.py @@ -113,6 +113,7 @@ def _resolve(file: File, page: Page): # Create badge def _badge(icon: str, text: str = "", type: str = ""): classes = f"mdx-badge mdx-badge--{type}" if type else "mdx-badge" + text = f"{text}{{ data-preview='' }}" if text.endswith(")") else text return "".join([ f"", *([f"{icon}"] if icon else []),