Formatting

This commit is contained in:
squidfunk 2021-03-07 15:40:20 +01:00
parent f14a96020b
commit f9cfd87708
5 changed files with 35 additions and 35 deletions

View File

@ -16,12 +16,11 @@ additional icons][1] with minimal effort.
### Logo ### Logo
[:octicons-file-code-24: Source][2] · [:octicons-file-code-24: Source][2] ·
:octicons-milestone-24: Default: [`material/library`](https://github.com/squidfunk/mkdocs-material/blob/master/material/.icons/material/library.svg) :octicons-milestone-24: Default: [`material/library`][3]
Configured in your `mkdocs.yml`; there are two types of _logo_ (choose only one): The _logo_ can be changed to a user-provided image (any type, incl. `*.png` and
`*.svg`) located in the `docs` folder, or to any icon bundled with the theme.
- `theme.logo` a user-provided image (_supports SVG_) located in the `docs` folder. Add the following lines to `mkdocs.yml`:
- `theme.icon.logo` for using [any icon bundled with the theme][3].
=== "Image" === "Image"
@ -30,7 +29,7 @@ Configured in your `mkdocs.yml`; there are two types of _logo_ (choose only one)
logo: assets/logo.png logo: assets/logo.png
``` ```
=== "Icon" === "Icon, bundled"
``` yaml ``` yaml
theme: theme:
@ -39,11 +38,12 @@ Configured in your `mkdocs.yml`; there are two types of _logo_ (choose only one)
``` ```
[2]: https://github.com/squidfunk/mkdocs-material/blob/master/src/partials/logo.html [2]: https://github.com/squidfunk/mkdocs-material/blob/master/src/partials/logo.html
[3]: https://github.com/squidfunk/mkdocs-material/tree/master/material/.icons [3]: https://github.com/squidfunk/mkdocs-material/blob/master/material/.icons/material/library.svg
[4]: https://github.com/squidfunk/mkdocs-material/tree/master/material/.icons
### Favicon ### Favicon
[:octicons-file-code-24: Source][4] · [:octicons-file-code-24: Source][5] ·
:octicons-milestone-24: Default: `assets/images/favicon.png` :octicons-milestone-24: Default: `assets/images/favicon.png`
The _favicon_ can be changed to a path pointing to a user-provided image, which The _favicon_ can be changed to a path pointing to a user-provided image, which
@ -54,15 +54,15 @@ theme:
favicon: images/favicon.png favicon: images/favicon.png
``` ```
[4]: https://github.com/squidfunk/mkdocs-material/blob/master/src/base.html [5]: https://github.com/squidfunk/mkdocs-material/blob/master/src/base.html
### Icons ### Icons
[:octicons-file-code-24: Source][3] · [:octicons-workflow-24: Extension][5] [:octicons-file-code-24: Source][4] · [:octicons-workflow-24: Extension][6]
The [Emoji][5] extension, which is part of [Python Markdown Extensions][6], The [Emoji][6] extension, which is part of [Python Markdown Extensions][7],
adds the ability to __integrate icons__ in the `*.svg` file format, which are adds the ability to __integrate icons__ in the `*.svg` file format, which are
inlined when [building your site][7]: inlined when [building your site][8]:
``` yaml ``` yaml
markdown_extensions: markdown_extensions:
@ -73,30 +73,30 @@ markdown_extensions:
The following icon sets are bundled with Material for MkDocs: The following icon sets are bundled with Material for MkDocs:
- :material-material-design: [Material Design][8] - :material-material-design: [Material Design][9]
- :fontawesome-brands-font-awesome-flag: [FontAwesome][9] - :fontawesome-brands-font-awesome-flag: [FontAwesome][10]
- :octicons-mark-github-16: [Octicons][10] - :octicons-mark-github-16: [Octicons][11]
If you want to add [additional icons][1], read on. If you want to add [additional icons][1], read on.
[5]: https://facelessuser.github.io/pymdown-extensions/extensions/emoji/ [6]: https://facelessuser.github.io/pymdown-extensions/extensions/emoji/
[6]: https://facelessuser.github.io/pymdown-extensions/ [7]: https://facelessuser.github.io/pymdown-extensions/
[7]: ../creating-your-site.md#building-your-site [8]: ../creating-your-site.md#building-your-site
[8]: https://materialdesignicons.com/ [9]: https://materialdesignicons.com/
[9]: https://fontawesome.com/icons?d=gallery&m=free [10]: https://fontawesome.com/icons?d=gallery&m=free
[10]: https://octicons.github.com/ [11]: https://octicons.github.com/
## Customization ## Customization
### Additional icons ### Additional icons
[:octicons-file-code-24: Source][3] · [:octicons-file-code-24: Source][4] ·
:octicons-mortar-board-24: Difficulty: _moderate_ :octicons-mortar-board-24: Difficulty: _moderate_
In order to add additional icons, [extend the theme][11], and create a folder In order to add additional icons, [extend the theme][12], and create a folder
named `.icons` in the [`custom_dir`][12] you want to use for overrides. Next, named `.icons` in the [`custom_dir`][13] you want to use for overrides. Next,
add your `*.svg` icons into a subfolder of the `.icons` folder. Let's say you add your `*.svg` icons into a subfolder of the `.icons` folder. Let's say you
downloaded and unpacked the [Bootstrap][13] icon set, and want to add it to downloaded and unpacked the [Bootstrap][14] icon set, and want to add it to
your project documentation. The structure of your project should look like this: your project documentation. The structure of your project should look like this:
``` sh ``` sh
@ -123,6 +123,6 @@ markdown_extensions:
You should now be able to use the :fontawesome-brands-bootstrap: Bootstrap You should now be able to use the :fontawesome-brands-bootstrap: Bootstrap
icons. icons.
[11]: ../customization.md#extending-the-theme [12]: ../customization.md#extending-the-theme
[12]: https://www.mkdocs.org/user-guide/configuration/#custom_dir [13]: https://www.mkdocs.org/user-guide/configuration/#custom_dir
[13]: https://icons.getbootstrap.com/ [14]: https://icons.getbootstrap.com/

View File

@ -217,7 +217,7 @@
</script> </script>
{% endblock %} {% endblock %}
{% block scripts %} {% block scripts %}
<script src="{{ 'assets/javascripts/bundle.b881577d.min.js' | url }}"></script> <script src="{{ 'assets/javascripts/bundle.45ec54dd.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

@ -180,8 +180,8 @@ export function setupInstantLoading(
.pipe( .pipe(
filter(ev => !ev.metaKey && !ev.ctrlKey), filter(ev => !ev.metaKey && !ev.ctrlKey),
switchMap(ev => { switchMap(ev => {
// Check for `Element` rather than `HTMLElement` to also
// handle <svg> elements within <a> elements. /* Handle HTML and SVG elements */
if (ev.target instanceof Element) { if (ev.target instanceof Element) {
const el = ev.target.closest("a") const el = ev.target.closest("a")
if (el && !el.target && urls.includes(el.href)) { if (el && !el.target && urls.includes(el.href)) {