mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2026-07-30 17:46:21 -04:00
Documentation
This commit is contained in:
@@ -97,7 +97,7 @@ The following properties are available for each alternate language:
|
||||
[ISO 639-1 language code]: https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
|
||||
[Language selector preview]: ../assets/screenshots/language-selection.png
|
||||
|
||||
#### Stay on page :material-alert-decagram:{ .mdx-pulse title="Added on December 8, 2023" }
|
||||
#### Stay on page
|
||||
|
||||
<!-- md:sponsors -->
|
||||
<!-- md:version insiders-4.47.0 -->
|
||||
|
||||
@@ -342,7 +342,7 @@ authors:
|
||||
[authors]: ../plugins/blog.md#authors
|
||||
[authors_file]: ../plugins/blog.md#config.authors_file
|
||||
|
||||
#### Adding author profiles :material-alert-decagram:{ .mdx-pulse title="Added on November 26, 2023" }
|
||||
#### Adding author profiles
|
||||
|
||||
<!-- md:sponsors -->
|
||||
<!-- md:version insiders-4.46.0 -->
|
||||
@@ -506,6 +506,29 @@ when the site is being built. Of course, you can also reference assets from
|
||||
posts outside of the `posts` directory. The [built-in blog plugin] ensures that
|
||||
all links are correct.
|
||||
|
||||
#### Pinning a post :material-alert-decagram:{ .mdx-pulse title="Added on February 24, 2024" }
|
||||
|
||||
<!-- md:sponsors -->
|
||||
<!-- md:version insiders-4.53.0 -->
|
||||
<!-- md:flag experimental -->
|
||||
|
||||
If you want to pin a post to the top of the index page, as well as the archive
|
||||
and category indexes it is part of, you can use the front matter `pin` property:
|
||||
|
||||
``` yaml
|
||||
---
|
||||
date: 2024-01-31
|
||||
pin: true
|
||||
---
|
||||
|
||||
# Hello world!
|
||||
...
|
||||
```
|
||||
|
||||
If multiple posts are pinned, they are sorted by their creation date, with the
|
||||
most recent pinned post being shown first, followed by the other pinned posts in
|
||||
descending order.
|
||||
|
||||
#### Setting the reading time
|
||||
|
||||
When [enabled], the [readtime] package is used to compute the expected reading
|
||||
|
||||
@@ -93,8 +93,8 @@ experience.
|
||||
|
||||
Instant previews are a brand new feature that allow the user to preview another
|
||||
site of your documentation without navigating to it. They can be very helpful to
|
||||
keep the user in context. A link can be opted into instant previews with the
|
||||
`data-preview` attribute:
|
||||
keep the user in context. Instant previews can be enabled on any internal link
|
||||
with the `data-preview` attribute:
|
||||
|
||||
```` markdown title="Link with instant preview"
|
||||
``` markdown
|
||||
@@ -108,6 +108,59 @@ keep the user in context. A link can be opted into instant previews with the
|
||||
|
||||
</div>
|
||||
|
||||
#### Automatic previews
|
||||
|
||||
<!-- md:sponsors -->
|
||||
<!-- md:version insiders-4.53.0 -->
|
||||
<!-- md:extension -->
|
||||
<!-- md:flag experimental -->
|
||||
|
||||
The recommended way to work with instant previews is to use the Markdown
|
||||
extension that is included with Material for MkDocs, as it allows you to enable
|
||||
instant previews on a per-page or per-section level for your documentation:
|
||||
|
||||
``` yaml
|
||||
markdown_extensions:
|
||||
- material.extensions.preview:
|
||||
targets:
|
||||
include:
|
||||
- changelog/index.md
|
||||
- customization.md
|
||||
- insiders/changelog/*
|
||||
- setup/extensions/*
|
||||
```
|
||||
|
||||
The above configuration is what we use for our documentation. We've enabled
|
||||
instant previews for our changelogs, customization guide, and Insiders sections,
|
||||
as well as for all Markdown extensions that we support.
|
||||
|
||||
!!! info "Full configuration example"
|
||||
|
||||
``` yaml
|
||||
markdown_extensions:
|
||||
- material.extensions.preview:
|
||||
sources: # (1)!
|
||||
include:
|
||||
- ...
|
||||
exclude:
|
||||
- ...
|
||||
targets: # (2)!
|
||||
include:
|
||||
- ...
|
||||
exclude:
|
||||
- ...
|
||||
```
|
||||
|
||||
1. Sources specify the pages _on_ which instant previews should be enabled.
|
||||
If this setting is omitted, instant previews will be enabled on all
|
||||
pages. You can use patterns to include or exclude pages. Exclusion is
|
||||
evaluated on top of inclusion, so if a page is matched by both, it will
|
||||
be excluded.
|
||||
|
||||
2. Targets specify the pages _to_ which instant previews should be enabled.
|
||||
This is the recommended way to enable instant previews.
|
||||
---
|
||||
|
||||
Instant previews can also be enabled globally by adding the following lines to
|
||||
`mkdocs.yml`, which will enable instant previews for all internal links,
|
||||
alleviating the need to add data attributes:
|
||||
|
||||
@@ -27,7 +27,7 @@ For a list of all settings, please consult the [plugin documentation].
|
||||
|
||||
[plugin documentation]: ../plugins/tags.md
|
||||
|
||||
#### Advanced settings :material-alert-decagram:{ .mdx-pulse title="Added on December 23, 2023" }
|
||||
#### Advanced settings
|
||||
|
||||
<!-- md:sponsors -->
|
||||
<!-- md:version insiders-4.48.0 -->
|
||||
@@ -211,7 +211,7 @@ arbitrary content before and after the marker:
|
||||
[tags.tags_file]: #tags-file
|
||||
[tags index enabled]: ../assets/screenshots/tags-index.png
|
||||
|
||||
### Advanced features :material-alert-decagram:{ .mdx-pulse title="Added on December 23, 2023" }
|
||||
### Advanced features
|
||||
|
||||
[Insiders] ships a __ground up rewrite of the tags plugin__ which is infinitely
|
||||
more powerful than the current version in the community edition. It allows
|
||||
|
||||
Reference in New Issue
Block a user