diff --git a/.github/assets/sponsors/hummingbot.png b/.github/assets/sponsors/hummingbot.png new file mode 100644 index 000000000..283987a02 Binary files /dev/null and b/.github/assets/sponsors/hummingbot.png differ diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 712e732f1..9e13024d2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -52,7 +52,7 @@ jobs: run: npm install - name: Check project - run: npm run lint + run: npm run check - name: Build project run: | diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 26e6c601e..7f9bf175b 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -46,7 +46,8 @@ jobs: pip install . pip install \ mkdocs-minify-plugin>=0.3 \ - mkdocs-redirects>=1.0 + mkdocs-redirects>=1.0 \ + mkdocs-rss-plugin>=0.17 - name: Install Insiders build if: github.event.repository.fork == false diff --git a/CHANGELOG b/CHANGELOG index 068d678ca..1872aec72 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,67 @@ +mkdocs-material-7.3.0 (2021-09-23) + + * Added support for sticky navigation tabs + * Added support for section index pages + * Added support for removing generator notice + +mkdocs-material-7.2.8 (2021-09-20) + + * Fixed #3039: Search modal overlays menu on mobile (7.2.7 regression) + +mkdocs-material-7.2.7+insiders-3.0.1 (2021-09-19) + + * Added support for using literal h1-6 tags for search plugin + * Fixed search plugin breaking on void elements without slashes + * Fixed search plugin filtering link contents from headlines + * Fixed search plugin handling of multiple h1 headlines + * Fixed search plugin handling of missing h1 headlines + +mkdocs-material-7.2.7 (2021-09-19) + + * Updated Serbian and Serbo-Croatian translations + * Improved appearance of outline on details + * Fixed #2934: Scrollbar when header is hidden on some mobile browsers + * Fixed #3032: Anchor in details doesn't open on load (7.0.0 regression) + * Fixed back-to-top button being focusable when invisible + * Fixed broken admonition icons (removed in upstream) + +mkdocs-material-7.2.6+insiders-3.0.0 (2021-09-13) + + * Rewrite of MkDocs' search plugin + * Added support for rich search previews + * Added support for tokenizer with lookahead + * Improved search indexing performance (twice as fast) + * Improved search highlighting + +mkdocs-material-7.2.6+insiders-2.13.3 (2021-09-01) + + * Added support for disabling social card generation + +mkdocs-material-7.2.6 (2021-09-01) + + * Fixed rendering of blockquote elements (7.0.0 regression) + * Fixed #2973: Custom search worker setting ignored + +mkdocs-material-7.2.5+insiders-2.13.2 (2021-08-25) + + * Fixed #2965: Social plugin error when primary color is not defined + +mkdocs-material-7.2.5 (2021-08-25) + + * Updated Portuguese translations + * Fixed execution of RxJS teardown logic (7.2.3 regression) + * Fixed #2970: Search results show escaped characters (7.2.2 regression) + +mkdocs-material-7.2.4+insiders-2.13.1 (2021-08-22) + + * Fixed #2948: Social cards are not cached + * Fixed #2953: Mermaid.js diagrams can't be centered anymore + +mkdocs-material-7.2.4 (2021-08-11) + + * Fixed #2926: Version selector not working (7.2.3 regression) + * Fixed #2929: Missing CSS class for banner (consistency with Insiders) + mkdocs-material-7.2.3 (2021-08-09) * Slight facelift of data tables, now closer to Material Design diff --git a/Dockerfile b/Dockerfile index 78d98a8d2..3b07cb1a7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -40,33 +40,40 @@ COPY setup.py setup.py # Perform build and cleanup artifacts and caches RUN \ - apk upgrade --update-cache -a && \ + apk upgrade --update-cache -a \ +&& \ apk add --no-cache \ git \ git-fast-import \ openssh \ - && apk add --no-cache --virtual .build gcc musl-dev \ - && pip install --no-cache-dir . \ - && \ - if [ "${WITH_PLUGINS}" = "true" ]; then \ - pip install --no-cache-dir \ - "mkdocs-minify-plugin>=0.3" \ - "mkdocs-redirects>=1.0"; \ - fi \ - && apk del .build gcc musl-dev \ - && \ - for theme in mkdocs readthedocs; do \ - rm -rf ${PACKAGES}/mkdocs/themes/$theme; \ - ln -s \ - ${PACKAGES}/material \ - ${PACKAGES}/mkdocs/themes/$theme; \ - done \ - && rm -rf /tmp/* /root/.cache \ - && \ - find ${PACKAGES} \ - -type f \ - -path "*/__pycache__/*" \ - -exec rm -f {} \; +&& \ + apk add --no-cache --virtual .build \ + gcc \ + musl-dev \ +&& \ + pip install --no-cache-dir . \ +&& \ + if [ "${WITH_PLUGINS}" = "true" ]; then \ + pip install --no-cache-dir \ + "mkdocs-minify-plugin>=0.3" \ + "mkdocs-redirects>=1.0"; \ + fi \ +&& \ + apk del .build \ +&& \ + for theme in mkdocs readthedocs; do \ + rm -rf ${PACKAGES}/mkdocs/themes/$theme; \ + ln -s \ + ${PACKAGES}/material \ + ${PACKAGES}/mkdocs/themes/$theme; \ + done \ +&& \ + rm -rf /tmp/* /root/.cache \ +&& \ + find ${PACKAGES} \ + -type f \ + -path "*/__pycache__/*" \ + -exec rm -f {} \; # Set working directory WORKDIR /docs diff --git a/README.md b/README.md index dc48e392b..65269b1e7 100644 --- a/README.md +++ b/README.md @@ -34,9 +34,6 @@ src="https://img.shields.io/docker/pulls/squidfunk/mkdocs-material" alt="Docker Pulls" /> -
@@ -53,13 +50,30 @@
- A demo is worth a thousand words — check it out at + Check out the demo – squidfunk.github.io/mkdocs-material.
+ ++ +
+ +
+ ## Features * **It's just Markdown ...** — write your technical documentation in Markdown – @@ -124,24 +138,15 @@ For other installation methods, configuration options, and a demo, visit [1]: https://squidfunk.github.io/mkdocs-material/ -## Premium Sponsors - - - ## Trusted by ... -### ... leading companies +### ... leading organizations -[Atlassian](https://atlassian-labs.github.io/data-center-helm-charts/), +[Atlassian](https://atlassian.github.io/data-center-helm-charts/), [AWS](https://aws.github.io/copilot-cli/), [Binance](https://docs.binance.org/), +[Bloomberg](https://bloomberg.github.io/selekt/), +[CERN](http://abpcomputing.web.cern.ch/), [Datadog](https://datadoghq.dev/integrations-core/), [Google](https://google.github.io/accompanist/), [ING](https://ing-bank.github.io/baker/), @@ -157,6 +162,7 @@ For other installation methods, configuration options, and a demo, visit ### ... and successful Open Source projects +[Arduino](https://arduino.github.io/arduino-cli/), [AutoKeras](https://autokeras.com/), [BFE](https://www.bfe-networks.net/), [Crystal](https://crystal-lang.org/reference/), diff --git a/docs/blog/2021/search-better-faster-smaller.md b/docs/blog/2021/search-better-faster-smaller.md new file mode 100644 index 000000000..50b473517 --- /dev/null +++ b/docs/blog/2021/search-better-faster-smaller.md @@ -0,0 +1,649 @@ +--- +template: overrides/main.html +description: > + How we rebuilt client-side search, delivering a better user experience while + making it faster and smaller at the same time +disqus: mkdocs-material +search: + exclude: true +--- + +# Search: better, faster, smaller + +__This is the story of how we managed to completely rebuild client-side search, +delivering a significantly better user experience while making it faster and +smaller at the same time.__ + + + + [1]: https://avatars.githubusercontent.com/u/932156 + +--- + +The [search][2] of Material for MkDocs is by far one of its best and most-loved +assets: [multilingual][3], [offline-capable][4], and most importantly: _all +client-side_. It provides a solution to empower the users of your documentation +to find what they're searching for instantly without the headache of managing +additional servers. However, even though several iterations have been made, +there's still some room for improvement, which is why we rebuilt the search +plugin and integration from the ground up. This article shines some light on the +internals of the new search, why it's much more powerful than the previous +version, and what's about to come. + +_The next section discusses the architecture and issues of the current search +implementation. If you immediately want to learn what's new, skip to the +[section just after that][5]._ + + [2]: ../../setup/setting-up-site-search.md + [3]: ../../setup/setting-up-site-search.md#lang + [4]: ../../setup/setting-up-site-search.md#offline-search + [5]: #whats-new + +## Architecture + +Material for MkDocs uses [lunr][6] together with [lunr-languages][7] to +implement its client-side search capabilities. When a documentation page is +loaded and JavaScript is available, the search index as generated by the +[built-in search plugin][8] during the build process is requested from the +server: + +``` ts +const index$ = document.forms.namedItem("search") + ? __search?.index || requestJSON
It's very easy to make some words bold and other words italic with Markdown. You can even add links, or even code
:
if (isAwesome){\n return true\n}\n
"
+ },
+ {
+ "location": "page/#lists",
+ "title": "Lists",
+ "text": "Sometimes you want numbered lists:
Sometimes you want bullet points:
code
: if (isAwesome){ … }\n
+ ```
+
+ === "Before"
+
+ ```
+ … links , or even code : if (isAwesome) { … }
+ ```
+
+ The punctuation issue is gone, as no additional whitespace is inserted, and
+ the preserved markup yields additional context to make scanning search
+ results more effective.
+
+On to the next step in the process: __tokenization__.
+
+ [23]: #search-index
+ [24]: search-better-faster-smaller/search-preview-now.png
+ [25]: search-better-faster-smaller/search-preview-before.png
+
+### Tokenizer lookahead
+
+The [default tokenizer][12] of [lunr][6] uses a regular expression to split a
+given string by matching each character against the [separator][11] as defined
+in `mkdocs.yml`. This doesn't allow for more complex separators based on
+lookahead or multiple characters.
+
+Fortunately, __our new search implementation provides an advanced tokenizer__
+that doesn't have these shortcomings and supports more complex regular
+expressions. As a result, Material for MkDocs just changed its own separator
+configuration to the following value:
+
+```
+[\s\-,:!=\[\]()"/]+|(?!\b)(?=[A-Z][a-z])|\.(?!\d)|&[lg]t;
+```
+
+While the first part up to the first `|` contains a list of single control
+characters at which the string should be split, the following three sections
+explain the remainder of the regular expression.[^4]
+
+ [^4]:
+ As a fun fact: the [separator default value][26] of the search plugin being
+ `[\s\-]+` always has been kind of irritating, as it suggests that multiple
+ characters can be considered being a separator. However, the `+` is
+ completely irrelevant, as regular expression groups involving multiple
+ characters were never supported by [lunr's default tokenizer][12].
+
+ [26]: https://www.mkdocs.org/user-guide/configuration/#separator
+
+#### Case changes
+
+Many programming languages use `PascalCase` or `camelCase` naming conventions.
+When a user searches for the term `case`, it's quite natural to expect for
+`PascalCase` and `camelCase` to show up. By adding the following match group to
+the separator, this can now be achieved with ease:
+
+```
+(?!\b)(?=[A-Z][a-z])
+```
+
+This regular expression is a combination of a negative lookahead (`\b`, i.e.,
+not a word boundary) and a positive lookahead (`[A-Z][a-z]`, i.e., an uppercase
+character followed by a lowercase character), and has the following behavior:
+
+- `PascalCase` :octicons-arrow-right-24: `Pascal`, `Case`
+- `camelCase` :octicons-arrow-right-24: `camel`, `Case`
+- `UPPERCASE` :octicons-arrow-right-24: `UPPERCASE`
+
+Searching for [:octicons-search-24: searchHighlight][27] now brings up the
+section discussing the `search.highlight` feature flag, which also demonstrates
+that this even works for search queries now![^5]
+
+ [^5]:
+ Previously, the search query was not correctly tokenized due to the way
+ [lunr][6] treats wildcards, as it disables the pipeline for search terms
+ that contain wildcards. In order to provide a good typeahead experience,
+ Material for MkDocs adds wildcards to the end of each search term not
+ explicitly preceded with `+` or `-`, effectively disabling tokenization.
+
+ [27]: ?q=searchHighlight
+
+#### Version numbers
+
+Indexing version numbers is another problem that can be solved with a small
+lookahead. Usually, `.` should be considered a separator to split words like
+`search.highlight`. However, splitting version numbers at `.` will make them
+undiscoverable. Thus, the following expression:
+
+```
+\.(?!\d)
+```
+
+This regular expression matches a `.` only if not immediately followed by a
+digit `\d`, which leaves version numbers discoverable. Searching for
+[:octicons-search-24: 7.2.6][28] brings up the [7.2.6][29] release notes.
+
+ [28]: ?q=7.2.6
+ [29]: ../../changelog.md#726-_-september-1-2021
+
+#### HTML/XML tags
+
+If your documentation includes HTML/XML code examples, you may want to allow
+users to find specific tag names. Unfortunately, the `<` and `>` control
+characters are encoded in code blocks as `<` and `>`. Now, adding the
+following expression to the separator allows for just that:
+
+```
+&[lg]t;
+```
+
+Searching for [:octicons-search-24: custom search worker script][30] brings up
+the section on [custom search][31] and matches the `script` tag among the other
+search terms discovered.
+
+---
+
+_We've only just begun to scratch the surface of the new possibilities
+tokenizer lookahead brings. If you found other useful expressions, you're
+invited to share them in the comment section._
+
+ [30]: ?q=custom+search+worker+script
+ [31]: ../../setup/setting-up-site-search.md#custom-search
+
+### Accurate highlighting
+
+Highlighting is the last step in the process of search and involves the
+highlighting of all search term occurrences in a given search result. For a
+long time, highlighting was implemented through dynamically generated
+[regular expressions][32].[^6]
+
+This approach has some problems with non-whitespace languages like Japanese or
+Chinese[^3] since it only works if the highlighted term is at a word boundary.
+However, Asian languages are tokenized using a [dedicated segmenter][33], which
+cannot be modeled with regular expressions.
+
+ [^6]:
+ Using the separator as defined in `mkdocs.yml`, a regular expression was
+ constructed that was trying to mimic the tokenizer. As an example, the
+ search query `search highlight` was transformed into the rather cumbersome
+ regular expression `(^|Author: {{ page.meta.author }}
+ {% endif %} +{% endblock %} +``` + + [7]: ../customization.md#extending-the-theme + ### Custom meta tags #### on all pages @@ -94,12 +113,13 @@ In order to add custom `meta` tags to your document, you can [extend the theme policies for search engines: ``` html +{% extends "base.html" %} + {% block extrahead %} {% endblock %} ``` - [7]: ../customization.md#extending-the-theme [8]: ../customization.md#overriding-blocks-recommended #### on a single page @@ -109,6 +129,8 @@ values for different pages, you can use the `page.meta` object inside your template override, e.g.: ``` html +{% extends "base.html" %} + {% block extrahead %} {% if page and page.meta and page.meta.robots %} diff --git a/docs/reference/variables.md b/docs/reference/variables.md index 5adea7738..3b8f07742 100644 --- a/docs/reference/variables.md +++ b/docs/reference/variables.md @@ -70,13 +70,13 @@ storage and management. _Example_: -=== "docs/page.md" +=== "`docs/page.md`" ```` markdown The unit price is {{ unit.price }} ```` -=== "mkdocs.yml" +=== "`mkdocs.yml`" ``` yaml extra: @@ -109,13 +109,13 @@ In your Markdown file, include snippets with Jinja's [`include`][4] function: _Example_: -=== "snippets/definitions.md" +=== "`snippets/definitions.md`" ``` markdown The unit price is {{ page.meta.unit.price }} ``` -=== "docs/page-1.md" +=== "`docs/page-1.md`" ``` markdown --- @@ -126,7 +126,7 @@ _Example_: {% include "definitions.md" %} ``` -=== "docs/page-2.md" +=== "`docs/page-2.md`" ``` markdown --- diff --git a/docs/setup/adding-a-comment-system.md b/docs/setup/adding-a-comment-system.md index 77c1e6430..2f41ec4e5 100644 --- a/docs/setup/adding-a-comment-system.md +++ b/docs/setup/adding-a-comment-system.md @@ -77,6 +77,8 @@ In order to integrate another JavaScript-based comment system provider, you can [extend the theme][7] and [override the `disqus` block][8]: ``` html +{% extends "base.html" %} + {% block disqus %} {% endblock %} diff --git a/docs/setup/changing-the-language.md b/docs/setup/changing-the-language.md index 433643814..4c53f2280 100644 --- a/docs/setup/changing-the-language.md +++ b/docs/setup/changing-the-language.md @@ -178,7 +178,7 @@ Click on a tile to change the directionality: [:octicons-file-code-24: Source][1] · :octicons-mortar-board-24: Difficulty: _easy_ -If you want to customize some of the translations for your language, just follow +If you want to customize some of the translations for a language, just follow the guide on [theme extension][9] and create a new partial in `partials/languages`, e.g. `en-custom.html`. Next, look up the translation you want to change in the [base translation][1] and add it to the partial. @@ -186,9 +186,14 @@ want to change in the [base translation][1] and add it to the partial. Let's say you want to change "__Table of contents__" to "__On this page__": ``` html -{% macro t(key) %}{{ { + +{% import "partials/languages/en.html" as fallback %} +{% macro override(key) %}{{ { "toc.title": "On this page" }[key] }}{% endmacro %} + + +{% macro t(key) %}{{ override(key) or fallback.t(key) }}{% endmacro %} ``` Then, add the following lines to `mkdocs.yml`: diff --git a/docs/setup/setting-up-navigation.md b/docs/setup/setting-up-navigation.md index 6200d33b6..26d0f89dd 100644 --- a/docs/setup/setting-up-navigation.md +++ b/docs/setup/setting-up-navigation.md @@ -43,9 +43,9 @@ _Material for MkDocs is the only MkDocs theme offering this feature._ ### Anchor tracking -[:octicons-file-code-24: Source][9] · +[:octicons-file-code-24: Source][6] · :octicons-unlock-24: Feature flag · -[:octicons-heart-fill-24:{ .mdx-heart } Insiders only][9]{ .mdx-insiders } +[:octicons-heart-fill-24:{ .mdx-heart } Insiders only][6]{ .mdx-insiders } When _anchor tracking_ is enabled, the URL in the address bar is automatically updated with the active anchor as highlighted in the table of contents. Add the @@ -57,9 +57,11 @@ theme: - navigation.tracking ``` + [6]: ../insiders/index.md + ### Navigation tabs -[:octicons-file-code-24: Source][6] · :octicons-unlock-24: Feature flag +[:octicons-file-code-24: Source][7] · :octicons-unlock-24: Feature flag When _tabs_ are enabled, top-level sections are rendered in a menu layer below the header for viewports above `1220px`, but remain as-is on mobile.[^1] Add @@ -82,22 +84,21 @@ theme: === "With tabs" - [![With tabs][7]][7] + [![With tabs][8]][8] === "Without tabs" - [![Without tabs][8]][8] + [![Without tabs][9]][9] - [6]: https://github.com/squidfunk/mkdocs-material/blob/master/src/partials/tabs.html - [7]: ../assets/screenshots/navigation-tabs.png - [8]: ../assets/screenshots/navigation.png + [7]: https://github.com/squidfunk/mkdocs-material/blob/master/src/partials/tabs.html + [8]: ../assets/screenshots/navigation-tabs.png + [9]: ../assets/screenshots/navigation.png #### Sticky navigation tabs -[:octicons-file-code-24: Source][9] · +[:octicons-file-code-24: Source][10] · :octicons-unlock-24: Feature flag · -:octicons-beaker-24: Experimental · -[:octicons-heart-fill-24:{ .mdx-heart } Insiders only][9]{ .mdx-insiders } +:octicons-beaker-24: Experimental When _sticky tabs_ are enabled, navigation tabs will lock below the header and always remain visible when scrolling down. Just add the following two feature @@ -112,19 +113,19 @@ theme: === "With sticky tabs" - [![With sticky tabs][10]][10] + [![With sticky tabs][11]][11] === "Without sticky tabs" - [![Without sticky tabs][11]][11] + [![Without sticky tabs][12]][12] - [9]: ../insiders/index.md - [10]: ../assets/screenshots/navigation-tabs-sticky.png - [11]: ../assets/screenshots/navigation-tabs-collapsed.png + [10]: https://github.com/squidfunk/mkdocs-material/blob/master/src/partials/header.html + [11]: ../assets/screenshots/navigation-tabs-sticky.png + [12]: ../assets/screenshots/navigation-tabs-collapsed.png ### Navigation sections -[:octicons-file-code-24: Source][12] · +[:octicons-file-code-24: Source][13] · :octicons-unlock-24: Feature flag When _sections_ are enabled, top-level sections are rendered as groups in the @@ -139,14 +140,14 @@ theme: === "With sections" - [![With sections][13]][13] + [![With sections][14]][14] === "Without sections" - [![Without sections][8]][8] + [![Without sections][9]][9] - [12]: https://github.com/squidfunk/mkdocs-material/blob/master/src/partials/nav-item.html - [13]: ../assets/screenshots/navigation-sections.png + [13]: https://github.com/squidfunk/mkdocs-material/blob/master/src/partials/nav-item.html + [14]: ../assets/screenshots/navigation-sections.png Both feature flags, _tabs_ and _sections_, can be combined with each other. If both feature flags are enabled, sections are rendered for level 2 navigation @@ -154,7 +155,7 @@ items. ### Navigation expansion -[:octicons-file-code-24: Source][12] · +[:octicons-file-code-24: Source][13] · :octicons-unlock-24: Feature flag When _expansion_ is enabled, the left sidebar will expand all collapsible @@ -169,20 +170,19 @@ theme: === "With expansion" - [![With expansion][14]][14] + [![With expansion][15]][15] === "Without expansion" - [![Without expansion][8]][8] + [![Without expansion][9]][9] - [14]: ../assets/screenshots/navigation-expand.png + [15]: ../assets/screenshots/navigation-expand.png ### Section index pages -[:octicons-file-code-24: Source][9] · +[:octicons-file-code-24: Source][16] · :octicons-unlock-24: Feature flag · -:octicons-beaker-24: Experimental · -[:octicons-heart-fill-24:{ .mdx-heart } Insiders only][9]{ .mdx-insiders } +:octicons-beaker-24: Experimental When _section index pages_ are enabled, documents can be directly attached to sections, which is particularly useful for providing overview pages. Add the @@ -196,11 +196,11 @@ theme: === "With section index pages" - [![With expansion][15]][15] + [![With expansion][17]][17] === "Without section index pages" - [![Without expansion][16]][16] + [![Without expansion][18]][18] In order to link a page to a section, create a new document with the name `index.md` in the respective folder, and add it to the beginning of your @@ -216,23 +216,16 @@ nav: ``` _This feature flag can be combined with all other feature flags, e.g. [tabs][1] -and [sections][2], except for table of contents [navigation integration][17]. -Note that it doesn't rely on third-party plugins[^2]._ +and [sections][2], except for table of contents [navigation integration][19]._ - [^2]: - If you don't want to use the native integration, the - [mkdocs-section-index][18] plugin might be an alternative. However, note - that this plugin may not be compatible with all navigation-related features - offered by Material for MkDocs. - - [15]: ../assets/screenshots/navigation-index-on.png - [16]: ../assets/screenshots/navigation-index-off.png - [17]: #navitation-intergation - [18]: https://github.com/oprypin/mkdocs-section-index + [16]: https://github.com/squidfunk/mkdocs-material/blob/master/src/partials/nav-item.html + [17]: ../assets/screenshots/navigation-index-on.png + [18]: ../assets/screenshots/navigation-index-off.png + [19]: #navigation-integration ### Back-to-top button -[:octicons-file-code-24: Source][19] · +[:octicons-file-code-24: Source][20] · :octicons-unlock-24: Feature flag A _back-to-top button_ can be shown when the user, after scrolling down, starts @@ -245,11 +238,10 @@ theme: - navigation.top ``` -[![back-to-top button][20]][20] +[![back-to-top button][21]][21] - [19]: https://github.com/squidfunk/mkdocs-material/blob/master/src/assets/stylesheets/main/layout/_top.scss - [20]: ../assets/screenshots/back-to-top.png - [21]: https://squidfunk.github.io/mkdocs-material-insiders/setup/setting-up-navigation/#back-to-top-button + [20]: https://github.com/squidfunk/mkdocs-material/blob/master/src/assets/stylesheets/main/layout/_top.scss + [21]: ../assets/screenshots/back-to-top.png ### Table of contents @@ -287,7 +279,7 @@ customize its appearance: : :octicons-milestone-24: Default: `headerid.slugify` – This option allows for customization of the slug function. For some languages, the default may not produce good and readable identifiers – consider using another slug function - like for example those from [Python Markdown Extensions][24]: + like for example those from [Python Markdown Extensions][25]: === "Unicode" @@ -358,7 +350,7 @@ theme: === "Separate table of contents" - [![Separate table of contents][7]][7] + [![Separate table of contents][8]][8] [26]: https://github.com/squidfunk/mkdocs-material/blob/master/src/assets/stylesheets/main/layout/_nav.scss [27]: ../assets/screenshots/toc-integrate.png diff --git a/docs/setup/setting-up-site-search.md b/docs/setup/setting-up-site-search.md index b986e33a3..ba230225f 100644 --- a/docs/setup/setting-up-site-search.md +++ b/docs/setup/setting-up-site-search.md @@ -17,8 +17,13 @@ with some effort, search can be made available [offline][1]. ### Built-in search +!!! danger "[Search: better, faster, smaller](../blog/2021/search-better-faster-smaller.md)" + + We rebuilt the search plugin and integration from the ground up, introducing [rich search previews](../blog/2021/search-better-faster-smaller.md#rich-search-previews), much better [tokenizer support](../blog/2021/search-better-faster-smaller.md#tokenizer-lookahead), [more accurate highlighting](../blog/2021/search-better-faster-smaller.md#accurate-highlighting) and much more. Read the [blog article](../blog/2021/search-better-faster-smaller.md) to learn more about our new search implementation. Start using it immediately by [becoming a sponsor][20]! + [:octicons-file-code-24: Source][2] · -[:octicons-cpu-24: Plugin][3] +[:octicons-cpu-24: Plugin][3] · +[:octicons-heart-fill-24:{ .mdx-heart } Better in Insiders][20]{ .mdx-insiders } The [built-in search plugin][3] integrates seamlessly with Material for MkDocs, adding multilingual client-side search with [lunr][4] and [lunr-languages][5]. @@ -152,7 +157,7 @@ theme: - search.suggest ``` -Searching for [:octicons-search-24: ^^search su^^][9] yields ^^search suggestions^^ as a suggestion: +Searching for [:octicons-search-24: search su][9] yields ^^search suggestions^^ as a suggestion: [![Search suggestions][10]][10] @@ -176,13 +181,10 @@ theme: - search.highlight ``` -Searching for [:octicons-search-24: ^^code blocks^^][12] yields: +Searching for [:octicons-search-24: code blocks][12] yields: [![Search highlighting][13]][13] - - - [11]: https://github.com/squidfunk/mkdocs-material/blob/master/src/assets/javascripts/components/search/highlight/index.ts [12]: ../reference/code-blocks.md?h=code+blocks [13]: ../assets/screenshots/search-highlighting.png @@ -312,6 +314,8 @@ customize the `transform` function, you can do this by [overriding the `config` block][24]: ``` html +{% extends "base.html" %} + {% block config %} {{ super() }} {% endblock %} {% block scripts %} - + {% for path in config["extra_javascript"] %} {% endfor %} diff --git a/material/overrides/assets/javascripts/bundle.25c9f9b3.min.js b/material/overrides/assets/javascripts/bundle.54f85274.min.js similarity index 65% rename from material/overrides/assets/javascripts/bundle.25c9f9b3.min.js rename to material/overrides/assets/javascripts/bundle.54f85274.min.js index 494bf428b..fd6333398 100644 --- a/material/overrides/assets/javascripts/bundle.25c9f9b3.min.js +++ b/material/overrides/assets/javascripts/bundle.54f85274.min.js @@ -1,4 +1,4 @@ -(()=>{var zo=Object.create;var De=Object.defineProperty;var Uo=Object.getOwnPropertyDescriptor;var qo=Object.getOwnPropertyNames,Br=Object.getOwnPropertySymbols,No=Object.getPrototypeOf,Gr=Object.prototype.hasOwnProperty,Vo=Object.prototype.propertyIsEnumerable;var Jr=(e,r,o)=>r in e?De(e,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[r]=o,Qe=(e,r)=>{for(var o in r||(r={}))Gr.call(r,o)&&Jr(e,o,r[o]);if(Br)for(var o of Br(r))Vo.call(r,o)&&Jr(e,o,r[o]);return e};var $o=e=>De(e,"__esModule",{value:!0});var he=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports);var Do=(e,r,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of qo(r))!Gr.call(e,t)&&t!=="default"&&De(e,t,{get:()=>r[t],enumerable:!(o=Uo(r,t))||o.enumerable});return e},Tr=e=>Do($o(De(e!=null?zo(No(e)):{},"default",e&&e.__esModule&&"default"in e?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e);var bt=he((An,Ge)=>{/*! ***************************************************************************** +(()=>{var zo=Object.create;var Qe=Object.defineProperty;var Uo=Object.getOwnPropertyDescriptor;var qo=Object.getOwnPropertyNames,Jr=Object.getOwnPropertySymbols,No=Object.getPrototypeOf,Br=Object.prototype.hasOwnProperty,Vo=Object.prototype.propertyIsEnumerable;var Gr=(e,r,o)=>r in e?Qe(e,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[r]=o,Ke=(e,r)=>{for(var o in r||(r={}))Br.call(r,o)&&Gr(e,o,r[o]);if(Jr)for(var o of Jr(r))Vo.call(r,o)&&Gr(e,o,r[o]);return e};var $o=e=>Qe(e,"__esModule",{value:!0});var he=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports);var Do=(e,r,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of qo(r))!Br.call(e,t)&&t!=="default"&&Qe(e,t,{get:()=>r[t],enumerable:!(o=Uo(r,t))||o.enumerable});return e},Or=e=>Do($o(Qe(e!=null?zo(No(e)):{},"default",e&&e.__esModule&&"default"in e?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e);var bt=he((An,Ge)=>{/*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any @@ -11,8 +11,8 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */var Yr,Xr,Zr,et,rt,tt,ot,nt,it,Ke,Or,at,st,lt,Se,ut,pt,ft,ct,mt,dt,ht,vt,Be;(function(e){var r=typeof global=="object"?global:typeof self=="object"?self:typeof this=="object"?this:{};typeof define=="function"&&define.amd?define("tslib",["exports"],function(t){e(o(r,o(t)))}):typeof Ge=="object"&&typeof Ge.exports=="object"?e(o(r,o(Ge.exports))):e(o(r));function o(t,n){return t!==r&&(typeof Object.create=="function"?Object.defineProperty(t,"__esModule",{value:!0}):t.__esModule=!0),function(i,s){return t[i]=n?n(i,s):s}}})(function(e){var r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])};Yr=function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");r(t,n);function i(){this.constructor=t}t.prototype=n===null?Object.create(n):(i.prototype=n.prototype,new i)},Xr=Object.assign||function(t){for(var n,i=1,s=arguments.length;i