1
0
mirror of https://github.com/squidfunk/mkdocs-material.git synced 2024-11-24 07:30:12 +01:00

Updated screenshots and refactored version selector template

This commit is contained in:
squidfunk 2021-03-14 12:17:19 +01:00
parent 9fe820010e
commit 0be8640aed
35 changed files with 93 additions and 69 deletions

View File

@ -40,7 +40,7 @@ COPY setup.py setup.py
# Perform build and cleanup artifacts and caches # Perform build and cleanup artifacts and caches
RUN \ RUN \
apk upgrade -U -a \ apk upgrade --update-cache -a \
apk add --no-cache \ apk add --no-cache \
git \ git \
git-fast-import \ git-fast-import \

Binary file not shown.

Before

Width:  |  Height:  |  Size: 167 KiB

After

Width:  |  Height:  |  Size: 167 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 173 KiB

After

Width:  |  Height:  |  Size: 173 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 132 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 117 KiB

After

Width:  |  Height:  |  Size: 117 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 128 KiB

After

Width:  |  Height:  |  Size: 139 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 140 KiB

After

Width:  |  Height:  |  Size: 135 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 126 KiB

After

Width:  |  Height:  |  Size: 131 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 173 KiB

After

Width:  |  Height:  |  Size: 184 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 142 KiB

After

Width:  |  Height:  |  Size: 138 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 142 KiB

After

Width:  |  Height:  |  Size: 141 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 174 KiB

After

Width:  |  Height:  |  Size: 184 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 197 KiB

After

Width:  |  Height:  |  Size: 203 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 179 KiB

After

Width:  |  Height:  |  Size: 184 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 156 KiB

After

Width:  |  Height:  |  Size: 164 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 168 KiB

After

Width:  |  Height:  |  Size: 177 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 132 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 344 KiB

After

Width:  |  Height:  |  Size: 359 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 154 KiB

After

Width:  |  Height:  |  Size: 138 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 163 KiB

After

Width:  |  Height:  |  Size: 136 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 168 KiB

After

Width:  |  Height:  |  Size: 141 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 161 KiB

After

Width:  |  Height:  |  Size: 154 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 138 KiB

After

Width:  |  Height:  |  Size: 124 KiB

View File

@ -217,11 +217,18 @@ In order to set a default theme based on user preference, add a valid media
query to the `media` attribute. This will render a color palette toggle in the query to the `media` attribute. This will render a color palette toggle in the
header next to the search bar: header next to the search bar:
<figure markdown="1"> <figure markdown="1">
[![Color palette toggle][11]][11] === "Light mode"
<figcaption markdown="1"> [![Light mode][11]][11]
=== "Dark mode"
[![Dark mode][12]][12]
<figcaption markdown="1" style="margin-top: -2.0rem">
A demo is worth a thousand words — check it out at A demo is worth a thousand words — check it out at
[squidfunk.github.io/mkdocs-material-insiders][7] [squidfunk.github.io/mkdocs-material-insiders][7]
@ -237,7 +244,7 @@ color palettes:
: :octicons-milestone-24: Default: _none_ · :octicons-alert-24: Required : :octicons-milestone-24: Default: _none_ · :octicons-alert-24: Required
This field must point to a valid icon path referencing [any icon bundled This field must point to a valid icon path referencing [any icon bundled
with the theme][12], or the build will not succeed. Some popular with the theme][13], or the build will not succeed. Some popular
combinations: combinations:
* :material-toggle-switch-off-outline: + :material-toggle-switch: `material/toggle-switch-off-outline` + `material/toggle-switch` * :material-toggle-switch-off-outline: + :material-toggle-switch: `material/toggle-switch-off-outline` + `material/toggle-switch`
@ -256,19 +263,20 @@ color palettes:
[8]: #color-scheme [8]: #color-scheme
[9]: #primary-color [9]: #primary-color
[10]: #accent-color [10]: #accent-color
[11]: ../assets/screenshots/color-palette-toggle.png [11]: ../assets/screenshots/palette-toggle-default.png
[12]: https://github.com/squidfunk/mkdocs-material/tree/master/material/.icons [12]: ../assets/screenshots/palette-toggle-slate.png
[13]: https://github.com/squidfunk/mkdocs-material/tree/master/material/.icons
## Customization ## Customization
### Custom colors ### Custom colors
[:octicons-file-code-24: Source][13] · [:octicons-file-code-24: Source][14] ·
:octicons-mortar-board-24: Difficulty: _easy_ :octicons-mortar-board-24: Difficulty: _easy_
Material for MkDocs implements colors using [CSS variables][14] (custom Material for MkDocs implements colors using [CSS variables][15] (custom
properties). If you want to customize the colors beyond the palette (e.g. to properties). If you want to customize the colors beyond the palette (e.g. to
use your brand-specific colors), you can add an [additional stylesheet][15] and use your brand-specific colors), you can add an [additional stylesheet][16] and
tweak the values of the CSS variables. tweak the values of the CSS variables.
Let's say you're :fontawesome-brands-youtube:{ style="color: #EE0F0F" } Let's say you're :fontawesome-brands-youtube:{ style="color: #EE0F0F" }
@ -283,22 +291,22 @@ add:
} }
``` ```
See the file containing the [color definitions][13] for a list of all CSS See the file containing the [color definitions][14] for a list of all CSS
variables. variables.
[13]: https://github.com/squidfunk/mkdocs-material/blob/master/src/assets/stylesheets/main/_colors.scss [14]: https://github.com/squidfunk/mkdocs-material/blob/master/src/assets/stylesheets/main/_colors.scss
[14]: https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties [15]: https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties
[15]: ../customization.md#additional-css [16]: ../customization.md#additional-css
### Custom color schemes ### Custom color schemes
[:octicons-file-code-24: Source][13] · [:octicons-file-code-24: Source][14] ·
:octicons-mortar-board-24: Difficulty: _easy_ :octicons-mortar-board-24: Difficulty: _easy_
Besides overriding specific colors, you can create your own, named color scheme Besides overriding specific colors, you can create your own, named color scheme
by wrapping the definitions in the `#!css [data-md-color-scheme="..."]` by wrapping the definitions in the `#!css [data-md-color-scheme="..."]`
[attribute selector][16], which you can then set via `mkdocs.yml` as described [attribute selector][17], which you can then set via `mkdocs.yml` as described
in the [color schemes][8] section: in the [color schemes][8] section:
``` css ``` css
@ -319,4 +327,4 @@ can tune the `slate` theme with:
} }
``` ```
[16]: https://www.w3.org/TR/selectors-4/#attribute-selectors [17]: https://www.w3.org/TR/selectors-4/#attribute-selectors

View File

@ -368,7 +368,7 @@ theme:
=== "Separate table of contents" === "Separate table of contents"
[![Separate table of contents][8]][8] [![Separate table of contents][7]][7]
[25]: https://github.com/squidfunk/mkdocs-material/blob/master/src/assets/stylesheets/main/layout/_nav.scss [25]: https://github.com/squidfunk/mkdocs-material/blob/master/src/assets/stylesheets/main/layout/_nav.scss
[26]: ../assets/screenshots/toc-integrate.png [26]: ../assets/screenshots/toc-integrate.png

View File

@ -151,7 +151,7 @@ theme:
- search.suggest - search.suggest
``` ```
Searching for ^^code high^^ yields ^^code highlighting^^ as a suggestion: Searching for ^^search su^^ yields ^^search suggestions^^ as a suggestion:
<figure markdown="1"> <figure markdown="1">
@ -186,7 +186,7 @@ theme:
- search.highlight - search.highlight
``` ```
Searching for ^^code blocks^^ yields: Searching for ^^code highlighting^^ yields:
<figure markdown="1"> <figure markdown="1">

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

View File

@ -39,7 +39,7 @@
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% block styles %} {% block styles %}
<link rel="stylesheet" href="{{ 'assets/stylesheets/main.77f3fd56.min.css' | url }}"> <link rel="stylesheet" href="{{ 'assets/stylesheets/main.6e4c7934.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.7fa14f5b.min.css' | url }}"> <link rel="stylesheet" href="{{ 'assets/stylesheets/palette.7fa14f5b.min.css' | url }}">
@ -217,7 +217,7 @@
</script> </script>
{% endblock %} {% endblock %}
{% block scripts %} {% block scripts %}
<script src="{{ 'assets/javascripts/bundle.1a39fc1d.min.js' | url }}"></script> <script src="{{ 'assets/javascripts/bundle.a1c7c35e.min.js' | url }}"></script>
{% for path in config["extra_javascript"] %} {% for path in config["extra_javascript"] %}
<script src="{{ path | url }}"></script> <script src="{{ path | url }}"></script>
{% endfor %} {% endfor %}

View File

@ -36,6 +36,31 @@ export interface Version {
aliases: string[] /* Version aliases */ aliases: string[] /* Version aliases */
} }
/* ----------------------------------------------------------------------------
* Helper functions
* ------------------------------------------------------------------------- */
/**
* Render a version
*
* @param version - Version
*
* @returns Element
*/
function renderVersion(version: Version): HTMLElement {
const config = configuration()
/* Ensure trailing slash, see https://bit.ly/3rL5u3f */
const url = new URL(`${version.version}/`, config.base)
return (
<li class="md-version__item">
<a href={url.toString()} class="md-version__link">
{version.title}
</a>
</li>
)
}
/* ---------------------------------------------------------------------------- /* ----------------------------------------------------------------------------
* Functions * Functions
* ------------------------------------------------------------------------- */ * ------------------------------------------------------------------------- */
@ -64,16 +89,7 @@ export function renderVersionSelector(versions: Version[]): HTMLElement {
{active.title} {active.title}
</span> </span>
<ul class="md-version__list"> <ul class="md-version__list">
{versions.map(version => ( {versions.map(renderVersion)}
<li class="md-version__item">
<a
class="md-version__link"
href={`${new URL(`${version.version}/`, config.base)}`}
>
{version.title}
</a>
</li>
))}
</ul> </ul>
</div> </div>
) )