Added demo repository badge (#7915)

* docs(shortcodes): Add example repository badge

* docs(shortcodes): Update description for 'Example Repository'

* docs(relations): link example repos in docs pages

* docs(shortcodes): Fix permanent link for convention page

* docs(shortcodes): Revert to commit 365dc24

* docs(shortcodes): Rename md:example to md:demonstration

* docs(shortcodes): Fix examples url

* docs(shortcodes): Add demo badge

* docs(shortcodes): Add badges for demo repositories

* docs(shortcodes): Replace md:demonstration with md:example

* docs(shortcodes): Replace demonstration with example

* docs(shortcodes): Replace demonstration with example

* docs(shortcodes): Build new theme

* docs(shortcodes): Build with pymdownx
This commit is contained in:
Niclas Heinz
2025-02-02 09:47:21 +01:00
committed by GitHub
parent 2c52fa28e8
commit 66f1fc668d
7 changed files with 32 additions and 6 deletions

File diff suppressed because one or more lines are too long

View File

@@ -54,7 +54,8 @@ def on_page_markdown(
elif type == "plugin": return _badge_for_plugin(args, page, files)
elif type == "extension": return _badge_for_extension(args, page, files)
elif type == "utility": return _badge_for_utility(args, page, files)
elif type == "example": return _badge_for_example(args, page, files)
elif type == "example": return _badge_for_example(args, page, files)
elif type == "demo": return _badge_for_demo(args, page, files)
elif type == "default":
if args == "none": return _badge_for_default_none(page, files)
elif args == "computed": return _badge_for_default_computed(page, files)
@@ -212,11 +213,21 @@ def _badge_for_example_download(text: str, page: Page, files: Files):
icon = "material-folder-download"
href = f"https://mkdocs-material.github.io/examples/{text}.zip"
return _badge(
icon = f"[:{icon}:]({href} 'Download example')",
icon = f"[:{icon}:]({href} 'Download example files')",
text = f"[`.zip`]({href})",
type = "right"
)
# Create badge for demo repository
def _badge_for_demo(text: str, page: Page, files: Files):
icon = "material-github"
href = f"https://github.com/mkdocs-material/{text}"
return _badge(
icon = f"[:{icon}:]({href} 'Demo repository')",
text = text,
type = "right"
)
# Create badge for default value
def _badge_for_default(text: str, page: Page, files: Files):
icon = "material-water"
@@ -280,4 +291,4 @@ def _badge_for_experimental(page: Page, files: Files):
href = _resolve_path("conventions.md#experimental", page, files)
return _badge(
icon = f"[:{icon}:]({href} 'Experimental')"
)
)