1
0
mirror of https://github.com/squidfunk/mkdocs-material.git synced 2024-11-27 17:00:54 +01:00

Added first example to documentation

This commit is contained in:
squidfunk 2023-09-18 19:36:02 +02:00
parent 9888723f86
commit fc45f52336
No known key found for this signature in database
GPG Key ID: 5ED40BC4F9C436DF
4 changed files with 19 additions and 4 deletions

4
.gitignore vendored
View File

@ -55,10 +55,6 @@ example.zip
# Never ignore .gitkeep files
!**/.gitkeep
# Husky hooks
.husky/.gitignore
.husky/_
# macOS internals
.DS_Store

View File

@ -31,6 +31,7 @@ For a list of all settings, please consult the [plugin documentation].
<!-- md:version 8.5.0 -->
<!-- md:flag experimental -->
<!-- md:download tags-with-icons -->
Each tag can be associated with an icon, which is then rendered inside the tag.
Before assigning icons to tags, associate each tag with a unique identifier,

View File

@ -54,6 +54,7 @@ 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 == "download": return _badge_for_download(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)
@ -190,6 +191,14 @@ def _badge_for_utility(text: str, page: Page, files: Files):
text = text
)
# Create badge for download
def _badge_for_download(text: str, page: Page, files: Files):
icon = "material-folder-download"
href = f"https://mkdocs-material.github.io/examples/{text}/"
return _badge(
icon = f"[:{icon}:]({href} 'View example and download as .zip')"
)
# Create badge for default value
def _badge_for_default(text: str, page: Page, files: Files):
icon = "material-water"

View File

@ -54,6 +54,7 @@ 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 == "download": return _badge_for_download(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)
@ -190,6 +191,14 @@ def _badge_for_utility(text: str, page: Page, files: Files):
text = text
)
# Create badge for download
def _badge_for_download(text: str, page: Page, files: Files):
icon = "material-folder-download"
href = f"https://mkdocs-material.github.io/examples/{text}/"
return _badge(
icon = f"[:{icon}:]({href} 'View example and download as .zip')"
)
# Create badge for default value
def _badge_for_default(text: str, page: Page, files: Files):
icon = "material-water"