mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Added support for displaying version aliases
This commit is contained in:
parent
485fa76fbc
commit
cc398ddc33
@ -317,6 +317,12 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"default": "stable"
|
"default": "stable"
|
||||||
|
},
|
||||||
|
"alias": {
|
||||||
|
"title": "Show alias next to version number",
|
||||||
|
"markdownDescription": "https://squidfunk.github.io/mkdocs-material/setup/setting-up-the-versioning/#version-alias",
|
||||||
|
"type": "boolean",
|
||||||
|
"default": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -23,5 +23,5 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
{{ super() }}
|
{{ super() }}
|
||||||
<script src="{{ 'assets/javascripts/custom.63a6dff3.min.js' | url }}"></script>
|
<script src="{{ 'assets/javascripts/custom.b457887c.min.js' | url }}"></script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -44,7 +44,7 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block styles %}
|
{% block styles %}
|
||||||
<link rel="stylesheet" href="{{ 'assets/stylesheets/main.732c4fb1.min.css' | url }}">
|
<link rel="stylesheet" href="{{ 'assets/stylesheets/main.6543a935.min.css' | url }}">
|
||||||
{% if config.theme.palette %}
|
{% if config.theme.palette %}
|
||||||
{% set palette = config.theme.palette %}
|
{% set palette = config.theme.palette %}
|
||||||
<link rel="stylesheet" href="{{ 'assets/stylesheets/palette.06af60db.min.css' | url }}">
|
<link rel="stylesheet" href="{{ 'assets/stylesheets/palette.06af60db.min.css' | url }}">
|
||||||
@ -249,7 +249,7 @@
|
|||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
<script src="{{ 'assets/javascripts/bundle.7c1205d0.min.js' | url }}"></script>
|
<script src="{{ 'assets/javascripts/bundle.ebd0bdb7.min.js' | url }}"></script>
|
||||||
{% for script in config.extra_javascript %}
|
{% for script in config.extra_javascript %}
|
||||||
{{ script | script_tag }}
|
{{ script | script_tag }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -83,6 +83,7 @@ export type Translations =
|
|||||||
export interface Versioning {
|
export interface Versioning {
|
||||||
provider: "mike" /* Version provider */
|
provider: "mike" /* Version provider */
|
||||||
default?: string | string[] /* Default version */
|
default?: string | string[] /* Default version */
|
||||||
|
alias?: boolean /* Show alias */
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -64,6 +64,11 @@ function renderVersion(version: Version): HTMLElement {
|
|||||||
<li class="md-version__item">
|
<li class="md-version__item">
|
||||||
<a href={`${url}`} class="md-version__link">
|
<a href={`${url}`} class="md-version__link">
|
||||||
{version.title}
|
{version.title}
|
||||||
|
{config.version?.alias && version.aliases.length && (
|
||||||
|
<span class="md-version__alias">
|
||||||
|
{version.aliases[0]}
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
)
|
)
|
||||||
@ -84,6 +89,7 @@ function renderVersion(version: Version): HTMLElement {
|
|||||||
export function renderVersionSelector(
|
export function renderVersionSelector(
|
||||||
versions: Version[], active: Version
|
versions: Version[], active: Version
|
||||||
): HTMLElement {
|
): HTMLElement {
|
||||||
|
const config = configuration()
|
||||||
versions = versions.filter(version => !version.properties?.hidden)
|
versions = versions.filter(version => !version.properties?.hidden)
|
||||||
return (
|
return (
|
||||||
<div class="md-version">
|
<div class="md-version">
|
||||||
@ -92,6 +98,11 @@ export function renderVersionSelector(
|
|||||||
aria-label={translation("select.version")}
|
aria-label={translation("select.version")}
|
||||||
>
|
>
|
||||||
{active.title}
|
{active.title}
|
||||||
|
{config.version?.alias && active.aliases.length && (
|
||||||
|
<span class="md-version__alias">
|
||||||
|
{active.aliases[0]}
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
</button>
|
</button>
|
||||||
<ul class="md-version__list">
|
<ul class="md-version__list">
|
||||||
{versions.map(renderVersion)}
|
{versions.map(renderVersion)}
|
||||||
|
@ -76,6 +76,12 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Version alias
|
||||||
|
&__alias {
|
||||||
|
margin-left: px2rem(6px);
|
||||||
|
opacity: 0.7;
|
||||||
|
}
|
||||||
|
|
||||||
// Version selection list
|
// Version selection list
|
||||||
&__list {
|
&__list {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
Loading…
Reference in New Issue
Block a user