mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Formatting
This commit is contained in:
parent
f14a96020b
commit
f9cfd87708
@ -16,12 +16,11 @@ additional icons][1] with minimal effort.
|
||||
### Logo
|
||||
|
||||
[: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):
|
||||
|
||||
- `theme.logo` a user-provided image (_supports SVG_) located in the `docs` folder.
|
||||
- `theme.icon.logo` for using [any icon bundled with the theme][3].
|
||||
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.
|
||||
Add the following lines to `mkdocs.yml`:
|
||||
|
||||
=== "Image"
|
||||
|
||||
@ -30,7 +29,7 @@ Configured in your `mkdocs.yml`; there are two types of _logo_ (choose only one)
|
||||
logo: assets/logo.png
|
||||
```
|
||||
|
||||
=== "Icon"
|
||||
=== "Icon, bundled"
|
||||
|
||||
``` yaml
|
||||
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
|
||||
[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
|
||||
|
||||
[:octicons-file-code-24: Source][4] ·
|
||||
[:octicons-file-code-24: Source][5] ·
|
||||
:octicons-milestone-24: Default: `assets/images/favicon.png`
|
||||
|
||||
The _favicon_ can be changed to a path pointing to a user-provided image, which
|
||||
@ -54,15 +54,15 @@ theme:
|
||||
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
|
||||
|
||||
[: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
|
||||
inlined when [building your site][7]:
|
||||
inlined when [building your site][8]:
|
||||
|
||||
``` yaml
|
||||
markdown_extensions:
|
||||
@ -73,30 +73,30 @@ markdown_extensions:
|
||||
|
||||
The following icon sets are bundled with Material for MkDocs:
|
||||
|
||||
- :material-material-design: – [Material Design][8]
|
||||
- :fontawesome-brands-font-awesome-flag: – [FontAwesome][9]
|
||||
- :octicons-mark-github-16: – [Octicons][10]
|
||||
- :material-material-design: – [Material Design][9]
|
||||
- :fontawesome-brands-font-awesome-flag: – [FontAwesome][10]
|
||||
- :octicons-mark-github-16: – [Octicons][11]
|
||||
|
||||
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/
|
||||
[7]: ../creating-your-site.md#building-your-site
|
||||
[8]: https://materialdesignicons.com/
|
||||
[9]: https://fontawesome.com/icons?d=gallery&m=free
|
||||
[10]: https://octicons.github.com/
|
||||
[6]: https://facelessuser.github.io/pymdown-extensions/extensions/emoji/
|
||||
[7]: https://facelessuser.github.io/pymdown-extensions/
|
||||
[8]: ../creating-your-site.md#building-your-site
|
||||
[9]: https://materialdesignicons.com/
|
||||
[10]: https://fontawesome.com/icons?d=gallery&m=free
|
||||
[11]: https://octicons.github.com/
|
||||
|
||||
## Customization
|
||||
|
||||
### Additional icons
|
||||
|
||||
[:octicons-file-code-24: Source][3] ·
|
||||
[:octicons-file-code-24: Source][4] ·
|
||||
:octicons-mortar-board-24: Difficulty: _moderate_
|
||||
|
||||
In order to add additional icons, [extend the theme][11], and create a folder
|
||||
named `.icons` in the [`custom_dir`][12] you want to use for overrides. Next,
|
||||
In order to add additional icons, [extend the theme][12], and create a folder
|
||||
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
|
||||
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:
|
||||
|
||||
``` sh
|
||||
@ -123,6 +123,6 @@ markdown_extensions:
|
||||
You should now be able to use the :fontawesome-brands-bootstrap: Bootstrap
|
||||
icons.
|
||||
|
||||
[11]: ../customization.md#extending-the-theme
|
||||
[12]: https://www.mkdocs.org/user-guide/configuration/#custom_dir
|
||||
[13]: https://icons.getbootstrap.com/
|
||||
[12]: ../customization.md#extending-the-theme
|
||||
[13]: https://www.mkdocs.org/user-guide/configuration/#custom_dir
|
||||
[14]: https://icons.getbootstrap.com/
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -217,7 +217,7 @@
|
||||
</script>
|
||||
{% endblock %}
|
||||
{% 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"] %}
|
||||
<script src="{{ path | url }}"></script>
|
||||
{% endfor %}
|
||||
|
@ -180,8 +180,8 @@ export function setupInstantLoading(
|
||||
.pipe(
|
||||
filter(ev => !ev.metaKey && !ev.ctrlKey),
|
||||
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) {
|
||||
const el = ev.target.closest("a")
|
||||
if (el && !el.target && urls.includes(el.href)) {
|
||||
|
Loading…
Reference in New Issue
Block a user