Fixed buggy content tabs overflow scrolling + updated documentation

This commit is contained in:
squidfunk 2021-10-11 14:14:04 +02:00
parent c4cf616670
commit 6fab1e3654
8 changed files with 325 additions and 321 deletions

File diff suppressed because it is too large Load Diff

View File

@ -6,20 +6,20 @@ template: overrides/main.html
## Material for MkDocs Insiders
### 3.1.2 <small>_ October 6, 2021</small>
### 3.1.2 <small>_ October 6, 2021</small> { id="3.1.2" }
- Fixed incorrect path separators for social cards on Windows
### 3.1.1 <small>_ September 26, 2021</small>
### 3.1.1 <small>_ September 26, 2021</small> { id="3.1.1" }
- Fixed ordering bug in search exclusion logic
### 3.1.0 <small>_ September 26, 2021</small>
### 3.1.0 <small>_ September 26, 2021</small> { id="3.1.0" }
- Added support for excluding pages, sections, and elements from search
- Fixed #2803: Code block annotations not visible when printing
### 3.0.1 <small>_ September 19, 2021</small>
### 3.0.1 <small>_ September 19, 2021</small> { id="3.0.1" }
- Added support for using literal `h1-6` tags for search plugin
- Fixed search plugin breaking on void elements without slashes
@ -27,7 +27,7 @@ template: overrides/main.html
- Fixed search plugin handling of multiple `h1` headlines
- Fixed search plugin handling of missing `h1` headlines
### 3.0.0 <small>_ September 13, 2021</small>
### 3.0.0 <small>_ September 13, 2021</small> { id="3.0.0" }
- Rewrite of MkDocs' search plugin
- Added support for rich search previews
@ -35,41 +35,41 @@ template: overrides/main.html
- Improved search indexing performance (twice as fast)
- Improved search highlighting
### 2.13.3 <small>_ September 1, 2021</small>
### 2.13.3 <small>_ September 1, 2021</small> { id="2.13.3" }
- Added support for disabling social card generation
### 2.13.2 <small>_ August 25, 2021</small>
### 2.13.2 <small>_ August 25, 2021</small> { id="2.13.2" }
- Fixed #2965: Social plugin error when primary color is not defined
### 2.13.1 <small>_ August 21, 2021</small>
### 2.13.1 <small>_ August 21, 2021</small> { id="2.13.1" }
- Fixed #2948: Social cards are not cached
- Fixed #2953: Mermaid.js diagrams can't be centered anymore
### 2.13.0 <small>_ August 7, 2021</small>
### 2.13.0 <small>_ August 7, 2021</small> { id="2.13.0" }
- Added support for custom colors in social cards
### 2.12.2 <small>_ August 4, 2021</small>
### 2.12.2 <small>_ August 4, 2021</small> { id="2.12.2" }
- Fixed #2891: Division by zero error in social plugin
### 2.12.1 <small>_ July 26, 2021</small>
### 2.12.1 <small>_ July 26, 2021</small> { id="2.12.1" }
- Fixed error in social plugin when `site_description` was not set
- Fixed error in social plugin for non-ASCII characters
### 2.12.0 <small>_ July 25, 2021</small>
### 2.12.0 <small>_ July 25, 2021</small> { id="2.12.0" }
- Added support for social cards
### 2.11.1 <small>_ July 20, 2021</small>
### 2.11.1 <small>_ July 20, 2021</small> { id="2.11.1" }
- Fixed order of tags index, now sorted alphabetically
### 2.11.0 <small>_ July 18, 2021</small>
### 2.11.0 <small>_ July 18, 2021</small> { id="2.11.0" }
- Improved Mermaid.js intergration, now stable
- Added support for sequence diagrams
@ -77,193 +77,193 @@ template: overrides/main.html
- Added support for cookie consent configuration
- Added feature flag to always enable annotations
### 2.10.0 <small>_ July 10, 2021</small>
### 2.10.0 <small>_ July 10, 2021</small> { id="2.10.0" }
- Added support for cookie consent
- Fixed #2807: Back-to-top button not hidden when using sticky tabs
### 2.9.2 <small>_ May 30, 2021</small>
### 2.9.2 <small>_ May 30, 2021</small> { id="2.9.2" }
- Moved tags to partial for easier customization
- Added support for hiding tags on any page
### 2.9.1 <small>_ May 24, 2021</small>
### 2.9.1 <small>_ May 24, 2021</small> { id="2.9.1" }
- Added missing guard for linking of content tabs
### 2.9.0 <small>_ May 23, 2021</small>
### 2.9.0 <small>_ May 23, 2021</small> { id="2.9.0" }
- Added support for linking of content tabs
### 2.8.0 <small>_ May 12, 2021</small>
### 2.8.0 <small>_ May 12, 2021</small> { id="2.8.0" }
- Added support for boosting pages in search
### 2.7.2 <small>_ May 8, 2021</small>
### 2.7.2 <small>_ May 8, 2021</small> { id="2.7.2" }
- Fixed #2638: Warnings shown when using `tags` plugin without directory URLs
### 2.7.1 <small>_ May 3, 2021</small>
### 2.7.1 <small>_ May 3, 2021</small> { id="2.7.1" }
- Fixed `git-revision-date-localized` plugin integration (2.7.0 regression)
### 2.7.0 <small>_ May 1, 2021</small>
### 2.7.0 <small>_ May 1, 2021</small> { id="2.7.0" }
- Added support for tags (with search integration)
### 2.6.0 <small>_ April 11, 2021</small>
### 2.6.0 <small>_ April 11, 2021</small> { id="2.6.0" }
- Stay on page when switching versions
### 2.5.0 <small>_ March 28, 2021</small>
### 2.5.0 <small>_ March 28, 2021</small> { id="2.5.0" }
- Added support for version warning
### 2.4.0 <small>_ March 20, 2021</small>
### 2.4.0 <small>_ March 20, 2021</small> { id="2.4.0" }
- Added support for custom admonition icons
- Fixed #2444: Code block annotations with extra comments have wrong index
### 2.3.1 <small>_ March 14, 2021</small>
### 2.3.1 <small>_ March 14, 2021</small> { id="2.3.1" }
- Fixed anchor offset for permalinks when using sticky navigation tabs
### 2.3.0 <small>_ March 13, 2021</small>
### 2.3.0 <small>_ March 13, 2021</small> { id="2.3.0" }
- Added support for back-to-top button
### 2.2.1 <small>_ March 4, 2021</small>
### 2.2.1 <small>_ March 4, 2021</small> { id="2.2.1" }
- Fixed #2382: Repository stats failing when no release tag is present
### 2.2.0 <small>_ February 28, 2021</small>
### 2.2.0 <small>_ February 28, 2021</small> { id="2.2.0" }
- Added support for code block annotations
### 2.1.0 <small>_ February 26, 2021</small>
### 2.1.0 <small>_ February 26, 2021</small> { id="2.1.0" }
- Added support for anchor tracking
### 2.0.0 <small>_ February 24, 2021</small>
### 2.0.0 <small>_ February 24, 2021</small> { id="2.0.0" }
- Migrated Insiders to the new architecture
- Swapped color palette toggle configuration
### 1.17.0 <small>_ January 31, 2021</small>
### 1.17.0 <small>_ January 31, 2021</small> { id="1.17.0" }
- Added support for section index pages
### 1.16.1 <small>_ January 26, 2021</small>
### 1.16.1 <small>_ January 26, 2021</small> { id="1.16.1" }
- Fixed #2249: Instant loading + sticky tabs result in invalid links
- Fixed #2248: Search highlighting URL parameter always added
- Fixed #2235: Version selector doesn't select current version for aliases
### 1.16.0 <small>_ January 7, 2021</small>
### 1.16.0 <small>_ January 7, 2021</small> { id="1.16.0" }
- Added latest release to repository info (GitHub)
- Slight facelift of repository info (lighter fonts, spacing and icons)
### 1.15.0 <small>_ January 2, 2021</small>
### 1.15.0 <small>_ January 2, 2021</small> { id="1.15.0" }
- Added support for native Mermaid.js integration
### 1.14.0 <small>_ December 30, 2020</small>
### 1.14.0 <small>_ December 30, 2020</small> { id="1.14.0" }
- Added support for sharing searches
### 1.13.2 <small>_ December 22, 2020</small>
### 1.13.2 <small>_ December 22, 2020</small> { id="1.13.2" }
- Fixed version selector + sticky tabs navigation rendering issues
- Fixed version selector wrapping
### 1.13.1 <small>_ December 20, 2020</small>
### 1.13.1 <small>_ December 20, 2020</small> { id="1.13.1" }
- Removed horizontal scrollbars on language and version selector
- Fixed type conversion in JavaScript config
### 1.13.0 <small>_ December 13, 2020</small>
### 1.13.0 <small>_ December 13, 2020</small> { id="1.13.0" }
- Refactored navigation tabs to simplify grouping behavior
- Added support for sticky navigation tabs
- Added support for arbitrary links in navigation tabs
- Fixed #2098: Subsequent active subsection not highlighted correctly
### 1.12.1 <small>_ December 8, 2020</small>
### 1.12.1 <small>_ December 8, 2020</small> { id="1.12.1" }
- Fixed empty language selector being shown
### 1.12.0 <small>_ December 6, 2020</small>
### 1.12.0 <small>_ December 6, 2020</small> { id="1.12.0" }
- Added support for adding a language selector
### 1.11.2 <small>_ November 29, 2020</small>
### 1.11.2 <small>_ November 29, 2020</small> { id="1.11.2" }
- Fixed #2068: Search highlight interprets code blocks as JavaScript
### 1.11.1 <small>_ November 29, 2020</small>
### 1.11.1 <small>_ November 29, 2020</small> { id="1.11.1" }
- Refactored styling to be more stable and easier to adjust
- Fixed some styling regressions from latest features
### 1.11.0 <small>_ November 22, 2020</small>
### 1.11.0 <small>_ November 22, 2020</small> { id="1.11.0" }
- Added support for rendering admonitions as inline blocks
### 1.10.0 <small>_ November 15, 2020</small>
### 1.10.0 <small>_ November 15, 2020</small> { id="1.10.0" }
- Added support for integrating table of contents into navigation
### 1.9.0 <small>_ November 7, 2020</small>
### 1.9.0 <small>_ November 7, 2020</small> { id="1.9.0" }
- Added support for hiding navigation and table of contents on any page
- Removed autohiding table of contents when empty
### 1.8.0 <small>_ November 1, 2020</small>
### 1.8.0 <small>_ November 1, 2020</small> { id="1.8.0" }
- Added support for navigation sections
- Fixed appearance of inactive search suggestions
### 1.7.0 <small>_ October 25, 2020</small>
### 1.7.0 <small>_ October 25, 2020</small> { id="1.7.0" }
- Added support for deploying multiple versions
- Fixed alignment of sidebar when content area is too small
### 1.6.0 <small>_ October 11, 2020</small>
### 1.6.0 <small>_ October 11, 2020</small> { id="1.6.0" }
- Added support for search suggestions to save keystrokes
- Added support for removing __Made with Material for MkDocs__ from footer
- Fixed #1915: search should go to first result by pressing ++enter++
### 1.5.1 <small>_ September 21, 2020</small>
### 1.5.1 <small>_ September 21, 2020</small> { id="1.5.1" }
- Fixed content area stretching to whole width for long code blocks
### 1.5.0 <small>_ September 19, 2020</small>
### 1.5.0 <small>_ September 19, 2020</small> { id="1.5.0" }
- Added support for autohiding table of contents when empty
### 1.4.1 <small>_ September 6, 2020</small>
### 1.4.1 <small>_ September 6, 2020</small> { id="1.4.1" }
- Improved typeahead and search result relevance and scoring
### 1.4.0 <small>_ August 30, 2020</small>
### 1.4.0 <small>_ August 30, 2020</small> { id="1.4.0" }
- Added support for autohiding header on scroll
### 1.3.0 <small>_ August 26, 2020</small>
### 1.3.0 <small>_ August 26, 2020</small> { id="1.3.0" }
- Added support for user-selectable color palettes
### 1.2.0 <small>_ August 11, 2020</small>
### 1.2.0 <small>_ August 11, 2020</small> { id="1.2.0" }
- Added feature to expand navigation by default
### 1.1.0 <small>_ August 3, 2020</small>
### 1.1.0 <small>_ August 3, 2020</small> { id="1.1.0" }
- Added highlighting of search results
### 1.0.0 <small>_ July 14, 2020</small>
### 1.0.0 <small>_ July 14, 2020</small> { id="1.0.0" }
- Added grouping of search results
- Added missing query terms to search result

View File

@ -115,8 +115,9 @@ The following configuration options are supported:
`prebuild_index`{ #search-prebuild-index }
: :octicons-milestone-24: Default: `false` · :octicons-archive-24: Deprecated
· :octicons-trash-24: 8.0.0 MkDocs can generate a [prebuilt index] of all pages during
: [:octicons-tag-24: 7.2.0][prebuilt index support] · :octicons-archive-24:
Deprecated · :octicons-trash-24: 8.0.0 · :octicons-milestone-24: Default:
`false` MkDocs can generate a [prebuilt index] of all pages during
build time, which provides performance improvements at the cost of more
bandwidth, as it reduces the build time of the search index:
@ -145,6 +146,7 @@ them at your own risk.
[lunr's default tokenizer]: https://github.com/olivernn/lunr.js/blob/aa5a878f62a6bba1e8e5b95714899e17e8150b38/lunr.js#L413-L456
[site language]: changing-the-language.md#site-language
[tokenizer lookahead]: #tokenizer-lookahead
[prebuilt index support]: https://github.com/squidfunk/mkdocs-material/releases/tag/5.0.0
[prebuilt index]: https://www.mkdocs.org/user-guide/configuration/#prebuild_index
[50% smaller]: ../blog/2021/search-better-faster-smaller.md#benchmarks

View File

@ -60,7 +60,7 @@ matches the new structure:
- If you've overridden a __template__, check the respective `*.html` file for
potential changes
??? quote "`base.html`"
=== ":octicons-file-code-24: base.html"
``` diff
@@ -61,7 +61,7 @@
@ -149,7 +149,7 @@ matches the new structure:
{% endfor %}
```
??? quote "`partials/footer.html`"
=== ":octicons-file-code-24: partials/footer.html"
``` diff
- <div class="md-footer-nav">
@ -221,7 +221,7 @@ matches the new structure:
<div class="md-footer-meta__inner md-grid">
```
??? quote "`partials/header.html`"
=== ":octicons-file-code-24: partials/header.html"
``` diff
@@ -6,21 +6,21 @@
@ -294,7 +294,7 @@ matches the new structure:
```
??? quote "`partials/source.html`"
=== ":octicons-file-code-24: partials/source.html"
``` diff
@@ -4,5 +4,5 @@
@ -306,7 +306,7 @@ matches the new structure:
{% include ".icons/" ~ icon ~ ".svg" %}
```
??? quote "`partials/toc.html`"
=== ":octicons-file-code-24: partials/toc.html"
``` diff
@@ -12,7 +12,7 @@
@ -332,11 +332,8 @@ matches the new structure:
- Added display of missing query terms to search results
- Reduced size of vendor bundle by 25% (84kb → 67kb)
- Reduced size of the Docker image to improve CI build performance
- Removed hero partial in favor of [custom implementation][1]
- Removed [deprecated front matter features][2]
[1]: deprecations.md#hero
[2]: deprecations.md#front-matter
- Removed hero partial in favor of custom implementation
- Removed deprecated front matter features
### Changes to `mkdocs.yml`
@ -346,8 +343,8 @@ does not contain the key, you can skip it.
#### `theme.features`
All feature flags that can be set from `mkdocs.yml`, like [tabs][3] and
[instant loading][4], are now prefixed with the name of the component or
All feature flags that can be set from `mkdocs.yml`, like [tabs] and
[instant loading], are now prefixed with the name of the component or
function they apply to, e.g. `navigation.*`:
=== "6.x"
@ -368,8 +365,8 @@ function they apply to, e.g. `navigation.*`:
- instant
```
[3]: setup/setting-up-navigation.md#navigation-tabs
[4]: setup/setting-up-navigation.md#instant-loading
[tabs]: setup/setting-up-navigation.md#navigation-tabs
[instant loading]: setup/setting-up-navigation.md#instant-loading
### Changes to `*.html` files
@ -381,7 +378,7 @@ matches the new structure:
- If you've overridden a __template__, check the respective `*.html` file for
potential changes
??? quote "`base.html`"
=== ":octicons-file-code-24: base.html"
``` diff
@@ -22,13 +22,6 @@
@ -551,7 +548,7 @@ matches the new structure:
{%- endfor -%}
```
??? quote "`partials/hero.html`"
=== ":octicons-file-code-24: partials/hero.html"
``` diff
@@ -1,12 +0,0 @@
@ -569,7 +566,7 @@ matches the new structure:
-</div>
```
??? quote "`partials/source-link`"
=== ":octicons-file-code-24: partials/source-link"
``` diff
-{#-
@ -593,23 +590,23 @@ matches the new structure:
### What's new?
- Reactive architecture try `#!js app.dialog$.next("Hi!")` in the console
- [Instant loading][4] make Material behave like a Single Page Application
- Improved CSS customization with [CSS variables][5] set your brand's colors
- [Instant loading] make Material behave like a Single Page Application
- Improved CSS customization with [CSS variables] set your brand's colors
- Improved CSS resilience, e.g. proper sidebar locking for customized headers
- Improved [icon integration][6] and configuration now including over 5k icons
- Improved [icon integration] and configuration now including over 5k icons
- Added possibility to use any icon for logo, repository and social links
- Search UI does not freeze anymore (moved to web worker)
- Search index built only once when using instant loading
- Improved extensible keyboard handling
- Support for [prebuilt search indexes][7]
- Support for [prebuilt search indexes]
- Support for displaying stars and forks for GitLab repositories
- Support for scroll snapping of sidebars and search results
- Reduced HTML and CSS footprint due to deprecation of Internet Explorer support
- Slight facelifting of some UI elements (Admonitions, tables, ...)
[5]: setup/changing-the-colors.md#custom-colors
[6]: setup/changing-the-logo-and-icons.md#icons
[7]: setup/setting-up-site-search.md#built-in-search
[CSS variables]: setup/changing-the-colors.md#custom-colors
[icon integration]: setup/changing-the-logo-and-icons.md#icons
[prebuilt search indexes]: setup/setting-up-site-search.md#built-in-search
### Changes to `mkdocs.yml`
@ -742,7 +739,7 @@ matches the new structure:
- If you've overridden a __template__, check the respective `*.html` file for
potential changes
??? quote "`base.html`"
=== ":octicons-file-code-24: base.html"
``` diff
@@ -2,7 +2,6 @@
@ -993,7 +990,7 @@ matches the new structure:
{% endfor %}
```
??? quote "`partials/footer.html`"
=== ":octicons-file-code-24: partials/footer.html"
``` diff
@@ -5,34 +5,34 @@
@ -1044,7 +1041,7 @@ matches the new structure:
{% endif %}
```
??? quote "`partials/header.html`"
=== ":octicons-file-code-24: partials/header.html"
``` diff
@@ -2,51 +2,43 @@
@ -1135,7 +1132,7 @@ matches the new structure:
</header>
```
??? quote "`partials/hero.html`"
=== ":octicons-file-code-24: partials/hero.html"
``` diff
@@ -1,9 +1,8 @@
@ -1151,7 +1148,7 @@ matches the new structure:
<div class="{{ class }}" data-md-component="hero">
```
??? quote "`partials/language.html`"
=== ":octicons-file-code-24: partials/language.html"
``` diff
@@ -3,12 +3,4 @@
@ -1170,7 +1167,7 @@ matches the new structure:
+{% macro t(key) %}{{ lang.t(key) | default(fallback.t(key)) }}{% endmacro %}
```
??? quote "`partials/logo.html`"
=== ":octicons-file-code-24: partials/logo.html"
``` diff
@@ -0,0 +1,9 @@
@ -1185,7 +1182,7 @@ matches the new structure:
+{% endif %}
```
??? quote "`partials/nav-item.html`"
=== ":octicons-file-code-24: partials/nav-item.html"
``` diff
@@ -14,9 +14,15 @@
@ -1217,7 +1214,7 @@ matches the new structure:
<a href="{{ nav_item.url | url }}" title="{{ nav_item.title | striptags }}" class="md-nav__link md-nav__link--active">
```
??? quote "`partials/nav.html`"
=== ":octicons-file-code-24: partials/nav.html"
``` diff
@@ -1,14 +1,10 @@
@ -1241,7 +1238,7 @@ matches the new structure:
</label>
```
??? quote "`partials/search.html`"
=== ":octicons-file-code-24: partials/search.html"
``` diff
@@ -6,15 +6,18 @@
@ -1269,7 +1266,7 @@ matches the new structure:
</div>
```
??? quote "`partials/social.html`"
=== ":octicons-file-code-24: partials/social.html"
``` diff
@@ -3,9 +3,12 @@
@ -1289,7 +1286,7 @@ matches the new structure:
{% endif %}
```
??? quote "`partials/source-date.html`"
=== ":octicons-file-code-24: partials/source-date.html"
``` diff
@@ -0,0 +1,15 @@
@ -1310,7 +1307,7 @@ matches the new structure:
+</div>
```
??? quote "`partials/source-link.html`"
=== ":octicons-file-code-24: partials/source-link.html"
``` diff
@@ -0,0 +1,13 @@
@ -1329,7 +1326,7 @@ matches the new structure:
+</a>
```
??? quote "`partials/source.html`"
=== ":octicons-file-code-24: partials/source.html"
``` diff
@@ -2,24 +2,11 @@
@ -1364,7 +1361,7 @@ matches the new structure:
</div>
```
??? quote "`partials/tabs-item.html`"
=== ":octicons-file-code-24: partials/tabs-item.html"
``` diff
@@ -1,7 +1,7 @@
@ -1378,7 +1375,7 @@ matches the new structure:
<a href="{{ nav_item.url | url }}" class="md-tabs__link md-tabs__link--active">
```
??? quote "`partials/tabs.html`"
=== ":octicons-file-code-24: partials/tabs.html"
``` diff
@@ -5,7 +5,7 @@
@ -1392,7 +1389,7 @@ matches the new structure:
{% for nav_item in nav %}
```
??? quote "`partials/toc-item.html`"
=== ":octicons-file-code-24: partials/toc-item.html"
``` diff
@@ -6,7 +6,7 @@
@ -1406,7 +1403,7 @@ matches the new structure:
{% include "partials/toc-item.html" %}
```
??? quote "`partials/toc.html`"
=== ":octicons-file-code-24: partials/toc.html"
``` diff
@@ -2,35 +2,22 @@

View File

@ -225,7 +225,7 @@
</script>
{% endblock %}
{% block scripts %}
<script src="{{ 'assets/javascripts/bundle.cf8790d7.min.js' | url }}"></script>
<script src="{{ 'assets/javascripts/bundle.526051bc.min.js' | url }}"></script>
{% for path in config["extra_javascript"] %}
<script src="{{ path | url }}"></script>
{% endfor %}

View File

@ -77,11 +77,16 @@ export function mountContentTabs(
): Observable<Component<ContentTabs>> {
const internal$ = new Subject<ContentTabs>()
internal$.subscribe(({ active }) => {
active.scrollIntoView({
behavior: "smooth",
block: "nearest",
inline: "start"
})
// TODO: Hack, scrollIntoView is too buggy
const container = active.parentElement!
if (
active.offsetLeft + active.offsetWidth > container.offsetWidth ||
active.offsetLeft < container.scrollLeft
)
container.scrollTo({
behavior: "smooth",
left: active.offsetLeft
})
})
/* Create and return component */