mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Added badges to view and download examples
This commit is contained in:
parent
7f080f2065
commit
11cb733741
@ -31,7 +31,7 @@ For a list of all settings, please consult the [plugin documentation].
|
|||||||
|
|
||||||
<!-- md:version 8.5.0 -->
|
<!-- md:version 8.5.0 -->
|
||||||
<!-- md:flag experimental -->
|
<!-- md:flag experimental -->
|
||||||
<!-- md:download tags-with-icons -->
|
<!-- md:example tags-with-icons -->
|
||||||
|
|
||||||
Each tag can be associated with an icon, which is then rendered inside the tag.
|
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,
|
Before assigning icons to tags, associate each tag with a unique identifier,
|
||||||
|
File diff suppressed because one or more lines are too long
@ -1 +0,0 @@
|
|||||||
{"version":3,"sources":["src/.overrides/assets/stylesheets/custom/_typeset.scss","../../../../src/.overrides/assets/stylesheets/custom.scss","src/assets/stylesheets/utilities/_break.scss","src/.overrides/assets/stylesheets/custom/layout/_banner.scss","src/.overrides/assets/stylesheets/custom/layout/_hero.scss","src/.overrides/assets/stylesheets/custom/layout/_iconsearch.scss","src/.overrides/assets/stylesheets/custom/layout/_sponsorship.scss"],"names":[],"mappings":"AA2BA,iBACE,cAIE,kBC7BF,CDgCA,QAEE,qBC/BF,CACF,CD0CE,qBACE,aCxCJ,CD6CE,sBACE,aC3CJ,CD+CE,uBACE,UC7CJ,CDgDI,8BAGE,QAAA,CACA,sBAAA,CAHA,iBAAA,CACA,UC5CN,CDkDI,8BAOE,WAAA,CAFA,WAAA,CAFA,MAAA,CAGA,eAAA,CALA,iBAAA,CACA,KAAA,CAEA,UC7CN,CDqDE,uBACE,2BCnDJ,CDuDE,0BACE,aCrDJ,CD2DE,uBACE,eCzDJ,CD4DI,8BACE,4BAAA,CACA,4BAAA,CACA,2CC1DN,CD6DM,uCACE,2BC3DR,CDgEI,uCAGE,4BC7DN,CD0DI,uCAGE,6BC7DN,CD0DI,uCA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,cJ4NN,CIhOI,yCAME,+DAAA,CALA,QAAA,CAIA,mBJ2NN,CIvNM,oDACE,kBJyNR,CIrNM,2CACE,kBJuNR,CInNM,6CAEE,YAAA,CADA,WJsNR,CIlNQ,0FACE,gBJoNV,CKrTI,2BACE,YAAA,CACA,iBLwTN,CKpTI,6BACE,cLsTN,CKlTI,sCACE,YAAA,CACA,cAAA,CACA,sBLoTN,CKjTM,wCACE,aAAA,CACA,aLmTR,CK1SI,mCACE,YL4SN,CKzSM,yCAEE,UAAA,CACA,UAAA,CAFA,aL6SR,CKtSI,6CAEE,UL+SN,CKjTI,6CAEE,WL+SN,CKjTI,mCAOE,kBAAA,CANA,aAAA,CAGA,aAAA,CACA,YAAA,CACA,eAAA,CAEA,kBAAA,CACA,sCACE,CAPF,YL8SN,CKnSM,kFACE,oBLqSR,CKlSQ,0FACE,mBLoSV,CK/RM,4CAME,+CAAA,CALA,yCAAA,CAEA,eAAA,CADA,eAAA,CAEA,kBAAA,CACA,iBLkSR,CK7RM,uCACE,aAAA,CAGA,mCAAA,CADA,WAAA,CAEA,uBAAA,CAHA,ULkSR,CKzRE,oCACE,eL2RJ,CKvRE,sEAEE,eLyRJ","file":"custom.css"}
|
|
1
material/.overrides/assets/stylesheets/custom.911930df.min.css
vendored
Normal file
1
material/.overrides/assets/stylesheets/custom.911930df.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"sources":["src/.overrides/assets/stylesheets/custom/_typeset.scss","../../../../src/.overrides/assets/stylesheets/custom.scss","src/assets/stylesheets/utilities/_break.scss","src/.overrides/assets/stylesheets/custom/layout/_banner.scss","src/.overrides/assets/stylesheets/custom/layout/_hero.scss","src/.overrides/assets/stylesheets/custom/layout/_iconsearch.scss","src/.overrides/assets/stylesheets/custom/layout/_sponsorship.scss"],"names":[],"mappings":"AA2BA,iBACE,cAIE,kBC7BF,CDgCA,QAEE,qBC/BF,CACF,CD0CE,qBACE,aCxCJ,CD6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,CIlPM,mEACE,kCJoPR,CI9OE,mCAIE,kCAAA,CAAA,0BAAA,CAHA,eAAA,CACA,eAAA,CAKA,yDAAA,CADA,oBAAA,CADA,kBJiPJ,CI5OI,+CACE,mBJ8ON,CI1OI,sDAEE,YAAA,CADA,WJ6ON,CIxOI,4DACE,oDJ0ON,CIvOM,kEACE,0CJyOR,CIpOI,yCAIE,yCAAA,CACA,gBAAA,CAJA,iBAAA,CAEA,WAAA,CADA,SJyON,CIlOI,mDAIE,aJoON,CIxOI,mDAIE,cJoON,CIxOI,yCAME,eAAA,CALA,QAAA,CAIA,SJmON,CI9NI,mDAIE,aJgON,CIpOI,mDAIE,cJgON,CIpOI,yCAME,+DAAA,CALA,QAAA,CAIA,mBJ+NN,CI3NM,oDACE,kBJ6NR,CIzNM,2CACE,kBJ2NR,CIvNM,6CAEE,YAAA,CADA,WJ0NR,CItNQ,0FACE,gBJwNV,CKzTI,2BACE,YAAA,CACA,iBL4TN,CKxTI,6BACE,cL0TN,CKtTI,sCACE,YAAA,CACA,cAAA,CACA,sBLwTN,CKrTM,wCACE,aAAA,CACA,aLuTR,CK9SI,mCACE,YLgTN,CK7SM,yCAEE,UAAA,CACA,UAAA,CAFA,aLiTR,CK1SI,6CAEE,ULmTN,CKrTI,6CAEE,WLmTN,CKrTI,mCAOE,kBAAA,CANA,aAAA,CAGA,aAAA,CACA,YAAA,CACA,eAAA,CAEA,kBAAA,CACA,sCACE,CAPF,YLkTN,CKvSM,kFACE,oBLySR,CKtSQ,0FACE,mBLwSV,CKnSM,4CAME,+CAAA,CALA,yCAAA,CAEA,eAAA,CADA,eAAA,CAEA,kBAAA,CACA,iBLsSR,CKjSM,uCACE,aAAA,CAGA,mCAAA,CADA,WAAA,CAEA,uBAAA,CAHA,ULsSR,CK7RE,oCACE,eL+RJ,CK3RE,sEAEE,eL6RJ","file":"custom.css"}
|
@ -54,7 +54,7 @@ def on_page_markdown(
|
|||||||
elif type == "plugin": return _badge_for_plugin(args, page, files)
|
elif type == "plugin": return _badge_for_plugin(args, page, files)
|
||||||
elif type == "extension": return _badge_for_extension(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 == "utility": return _badge_for_utility(args, page, files)
|
||||||
elif type == "download": return _badge_for_download(args, page, files)
|
elif type == "example": return _badge_for_example(args, page, files)
|
||||||
elif type == "default":
|
elif type == "default":
|
||||||
if args == "none": return _badge_for_default_none(page, files)
|
if args == "none": return _badge_for_default_none(page, files)
|
||||||
elif args == "computed": return _badge_for_default_computed(page, files)
|
elif args == "computed": return _badge_for_default_computed(page, files)
|
||||||
@ -191,12 +191,30 @@ def _badge_for_utility(text: str, page: Page, files: Files):
|
|||||||
text = text
|
text = text
|
||||||
)
|
)
|
||||||
|
|
||||||
# Create badge for download
|
# Create badge for example
|
||||||
def _badge_for_download(text: str, page: Page, files: Files):
|
def _badge_for_example(text: str, page: Page, files: Files):
|
||||||
icon = "material-folder-download"
|
return "\n".join([
|
||||||
|
_badge_for_example_download(text, page, files),
|
||||||
|
_badge_for_example_view(text, page, files)
|
||||||
|
])
|
||||||
|
|
||||||
|
# Create badge for example view
|
||||||
|
def _badge_for_example_view(text: str, page: Page, files: Files):
|
||||||
|
icon = "material-folder-eye"
|
||||||
href = f"https://mkdocs-material.github.io/examples/{text}/"
|
href = f"https://mkdocs-material.github.io/examples/{text}/"
|
||||||
return _badge(
|
return _badge(
|
||||||
icon = f"[:{icon}:]({href} 'View example and download as .zip')"
|
icon = f"[:{icon}:]({href} 'View example')",
|
||||||
|
type = "right"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Create badge for example download
|
||||||
|
def _badge_for_example_download(text: str, page: Page, files: Files):
|
||||||
|
icon = "material-folder-download"
|
||||||
|
href = f"https://mkdocs-material.github.io/examples/download/{text}.zip"
|
||||||
|
return _badge(
|
||||||
|
icon = f"[:{icon}:]({href} 'Download example')",
|
||||||
|
text = f"[`.zip`]({href})",
|
||||||
|
type = "right"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Create badge for default value
|
# Create badge for default value
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
-#}
|
-#}
|
||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
{% block extrahead %}
|
{% block extrahead %}
|
||||||
<link rel="stylesheet" href="{{ 'assets/stylesheets/custom.024fa163.min.css' | url }}">
|
<link rel="stylesheet" href="{{ 'assets/stylesheets/custom.911930df.min.css' | url }}">
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block announce %}
|
{% block announce %}
|
||||||
For updates follow <strong>@squidfunk</strong> on
|
For updates follow <strong>@squidfunk</strong> on
|
||||||
|
@ -109,6 +109,12 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Badge moved to the right
|
||||||
|
&--right {
|
||||||
|
float: right;
|
||||||
|
margin-left: .35em;
|
||||||
|
}
|
||||||
|
|
||||||
// Badge icon
|
// Badge icon
|
||||||
&__icon {
|
&__icon {
|
||||||
padding: px2rem(4px);
|
padding: px2rem(4px);
|
||||||
|
@ -54,7 +54,7 @@ def on_page_markdown(
|
|||||||
elif type == "plugin": return _badge_for_plugin(args, page, files)
|
elif type == "plugin": return _badge_for_plugin(args, page, files)
|
||||||
elif type == "extension": return _badge_for_extension(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 == "utility": return _badge_for_utility(args, page, files)
|
||||||
elif type == "download": return _badge_for_download(args, page, files)
|
elif type == "example": return _badge_for_example(args, page, files)
|
||||||
elif type == "default":
|
elif type == "default":
|
||||||
if args == "none": return _badge_for_default_none(page, files)
|
if args == "none": return _badge_for_default_none(page, files)
|
||||||
elif args == "computed": return _badge_for_default_computed(page, files)
|
elif args == "computed": return _badge_for_default_computed(page, files)
|
||||||
@ -191,12 +191,30 @@ def _badge_for_utility(text: str, page: Page, files: Files):
|
|||||||
text = text
|
text = text
|
||||||
)
|
)
|
||||||
|
|
||||||
# Create badge for download
|
# Create badge for example
|
||||||
def _badge_for_download(text: str, page: Page, files: Files):
|
def _badge_for_example(text: str, page: Page, files: Files):
|
||||||
icon = "material-folder-download"
|
return "\n".join([
|
||||||
|
_badge_for_example_download(text, page, files),
|
||||||
|
_badge_for_example_view(text, page, files)
|
||||||
|
])
|
||||||
|
|
||||||
|
# Create badge for example view
|
||||||
|
def _badge_for_example_view(text: str, page: Page, files: Files):
|
||||||
|
icon = "material-folder-eye"
|
||||||
href = f"https://mkdocs-material.github.io/examples/{text}/"
|
href = f"https://mkdocs-material.github.io/examples/{text}/"
|
||||||
return _badge(
|
return _badge(
|
||||||
icon = f"[:{icon}:]({href} 'View example and download as .zip')"
|
icon = f"[:{icon}:]({href} 'View example')",
|
||||||
|
type = "right"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Create badge for example download
|
||||||
|
def _badge_for_example_download(text: str, page: Page, files: Files):
|
||||||
|
icon = "material-folder-download"
|
||||||
|
href = f"https://mkdocs-material.github.io/examples/download/{text}.zip"
|
||||||
|
return _badge(
|
||||||
|
icon = f"[:{icon}:]({href} 'Download example')",
|
||||||
|
text = f"[`.zip`]({href})",
|
||||||
|
type = "right"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Create badge for default value
|
# Create badge for default value
|
||||||
|
Loading…
Reference in New Issue
Block a user