Prepare 8.2.13+insiders-4.14.0 release

This commit is contained in:
squidfunk 2022-05-05 09:36:38 +02:00
parent 3666d09c8d
commit 8d2846f0f3
7 changed files with 148 additions and 3 deletions

View File

@ -1,3 +1,8 @@
mkdocs-material-8.2.13+insiders-4.14.0 (2022-05-05)
* Added Chinese language support to built-in search plugin
* Fixed all-numeric page titles raising error in social plugin
mkdocs-material-8.2.13 (2022-05-02) mkdocs-material-8.2.13 (2022-05-02)
* Fixed #3865: Tags index links to tagged pages 404 on Windows * Fixed #3865: Tags index links to tagged pages 404 on Windows

View File

@ -0,0 +1,91 @@
---
template: overrides/blog.html
title: Chinese search support
description: >
Insiders adds Chinese language support for the built-in search plugin a
feature that has been requested many times
hide:
- feedback
---
# Chinese search support 中文搜索​支持
__Insiders adds experimental Chinese language support for the [built-in search
plugin] a feature that has been requested for a long time given the large
number of Chinese users.__
<aside class="mdx-author" markdown>
![@squidfunk][@squidfunk avatar]
<span>__Martin Donath__ · @squidfunk</span>
<span>
:octicons-calendar-24: May 5, 2022 ·
:octicons-clock-24: 5 min read ·
[:octicons-tag-24: 8.2.13+insiders-4.14.0][insiders-4.14.0]
</span>
</aside>
[built-in search plugin]: ../../setup/setting-up-site-search.md#built-in-search-plugin
[@squidfunk avatar]: https://avatars.githubusercontent.com/u/932156
[insiders-4.14.0]: ../../insiders/changelog.md#4.14.0
---
After the United States and Germany, the third-largest country of origin of
Material for MkDocs users is China. For a long time, the built-in search plugin
didn't allow for proper segmentation of Chinese characters, mainly due to
missing support in [lunr-languages] which is used for search tokenization and
stemming. The latest Insiders release adds long-awaited Chinese language support
for the built-in search plugin, something that has been requested by many users.
_Material for MkDocs終於支持中文文本正確分割並且容易找到。_
{ style="display: inline" }
_This article explains how to set up Chinese language support for the built-in
search plugin in a few minutes._
{ style="display: inline" }
[lunr-languages]: https://github.com/MihaiValentin/lunr-languages
## Configuration
Chinese language support for Material for MkDocs is provided by [jieba], an
excellent Chinese text segmentation library. If [jieba] is installed, the
built-in search plugin automatically detects Chinese characters and runs them
through the segmenter. You can install [jieba] with:
```
pip install jieba
```
The next step is only required if you specified the [separator] configuration
in `mkdocs.yml`. Text is segmented with [zero-width whitespace] characters, so
it renders exactly the same in the search modal. Adjust `mkdocs.yml` so that
the [separator] includes the `\u200b` character:
``` yaml
plugins:
- search:
separator: '[\\s\\u200b\\-]'
```
That's all that is necessary.
## Usage
If you followed the instructions in the configuration guide, Chinese words will
now be tokenized using [jieba]. Try searching for
[:octicons-search-24: 支持][q=支持] to see how it integrates with the
built-in search plugin.
---
Note that this is an experimental feature, and I, @squidfunk, am not
proficient in Chinese (yet?). If you find a bug or think something can be
improved, please [open an issue].
[jieba]: https://pypi.org/project/jieba/
[zero-width whitespace]: https://en.wikipedia.org/wiki/Zero-width_space
[separator]: ../../setup/setting-up-site-search.md#separator
[q=支持]: ?q=支持
[open an issue]: https://github.com/squidfunk/mkdocs-material/issues/new/choose

View File

@ -13,6 +13,40 @@ search:
# Blog # Blog
## [Chinese search support 中文搜索​支持]
__Insiders adds experimental Chinese language support for the [built-in search
plugin] a feature that has been requested for a long time given the large
number of Chinese users.__
<aside class="mdx-author" markdown>
![@squidfunk][@squidfunk avatar]
<span>__Martin Donath__ · @squidfunk</span>
<span>
:octicons-calendar-24: May 5, 2022 ·
:octicons-clock-24: 5 min read ·
[:octicons-tag-24: 8.2.13+insiders-4.14.0][insiders-4.14.0]
</span>
</aside>
---
After the United States and Germany, the third-largest country of origin of
Material for MkDocs users is China. For a long time, the built-in search plugin
didn't allow for proper segmentation of Chinese characters, mainly due to
missing support in [lunr-languages] which is used for search tokenization and
stemming. The latest Insiders release adds long-awaited Chinese language support
for the built-in search plugin, something that has been requested by many users.
[:octicons-arrow-right-24: Continue reading][Chinese search support 中文搜索​支持]
[built-in search plugin]: ../setup/setting-up-site-search.md#built-in-search-plugin
[@squidfunk avatar]: https://avatars.githubusercontent.com/u/932156
[insiders-4.14.0]: ../insiders/changelog.md#4.14.0
[lunr-languages]: https://github.com/MihaiValentin/lunr-languages
[Chinese search support 中文搜索​支持]: 2022/chinese-search-support.md
## [The past, present and future] ## [The past, present and future]
__2021 was a fantastic year for this project as we shipped many new awesome __2021 was a fantastic year for this project as we shipped many new awesome
@ -29,8 +63,6 @@ project sustainable.__
</span> </span>
</aside> </aside>
[@squidfunk avatar]: https://avatars.githubusercontent.com/u/932156
--- ---
Today, together, MkDocs and Material for MkDocs are among the most popular Today, together, MkDocs and Material for MkDocs are among the most popular

View File

@ -6,6 +6,11 @@ template: overrides/main.html
## Material for MkDocs Insiders ## Material for MkDocs Insiders
### 4.14.0 <small>_ May 5, 2022</small> { id="4.14.0" }
- Added Chinese language support to built-in search plugin
- Fixed all-numeric page titles raising error in social plugin
### 4.13.2 <small>_ April 30, 2022</small> { id="4.13.2" } ### 4.13.2 <small>_ April 30, 2022</small> { id="4.13.2" }
- Improved caching of downloaded resources in privacy plugin - Improved caching of downloaded resources in privacy plugin

View File

@ -174,6 +174,7 @@ which are currently exclusively available to sponsors:
<div class="mdx-columns" markdown> <div class="mdx-columns" markdown>
- [x] [Chinese search support] :material-new-box:
- [x] [Tag icons] :material-new-box: - [x] [Tag icons] :material-new-box:
- [x] [Card grids] :material-new-box: - [x] [Card grids] :material-new-box:
- [x] [Offline plugin] - [x] [Offline plugin]
@ -262,12 +263,14 @@ are released for general availability.
#### $ 12,000 Piri Piri #### $ 12,000 Piri Piri
- [x] [Annotations] - [x] [Annotations]
- [x] [Chinese search support]
- [x] [Navigation icons] - [x] [Navigation icons]
- [ ] Navigation status badges - [ ] Navigation status badges
- [ ] Navigation pruning - [ ] Navigation pruning
- [ ] Blog - [ ] Blog
[Annotations]: ../reference/annotations.md [Annotations]: ../reference/annotations.md
[Chinese search support]: ../blog/2022/chinese-search-support.md
[Navigation icons]: ../reference/index.md#setting-the-page-icon [Navigation icons]: ../reference/index.md#setting-the-page-icon
#### $ 14,000 Goat's Horn #### $ 14,000 Goat's Horn

View File

@ -92,6 +92,12 @@ The following configuration options are supported:
part of this list by automatically falling back to the stemmer yielding the part of this list by automatically falling back to the stemmer yielding the
best result. best result.
!!! tip "Chinese search support 中文搜索​支持"
Material for MkDocs recently added __experimental language support for
Chinese__ as part of [Insiders]. [Read the blog article][chinese search]
to learn how to set up search for Chinese in a matter of minutes.
`separator`{ #search-separator } `separator`{ #search-separator }
: :octicons-milestone-24: Default: _automatically set_ The separator for : :octicons-milestone-24: Default: _automatically set_ The separator for
@ -143,6 +149,7 @@ them at your own risk.
[search support]: https://github.com/squidfunk/mkdocs-material/releases/tag/0.1.0 [search support]: https://github.com/squidfunk/mkdocs-material/releases/tag/0.1.0
[lunr]: https://lunrjs.com [lunr]: https://lunrjs.com
[lunr-languages]: https://github.com/MihaiValentin/lunr-languages [lunr-languages]: https://github.com/MihaiValentin/lunr-languages
[chinese search]: ../blog/2022/chinese-search-support.md
[lunr's default tokenizer]: https://github.com/olivernn/lunr.js/blob/aa5a878f62a6bba1e8e5b95714899e17e8150b38/lunr.js#L413-L456 [lunr's default tokenizer]: https://github.com/olivernn/lunr.js/blob/aa5a878f62a6bba1e8e5b95714899e17e8150b38/lunr.js#L413-L456
[site language]: changing-the-language.md#site-language [site language]: changing-the-language.md#site-language
[tokenizer lookahead]: #tokenizer-lookahead [tokenizer lookahead]: #tokenizer-lookahead

View File

@ -217,6 +217,8 @@ nav:
- Changelog: insiders/changelog.md - Changelog: insiders/changelog.md
- Blog: - Blog:
- blog/index.md - blog/index.md
- 2022:
- blog/2022/chinese-search-support.md
- 2021: - 2021:
- blog/2021/the-past-present-and-future.md - blog/2021/the-past-present-and-future.md
- blog/2021/excluding-content-from-search.md - blog/2021/excluding-content-from-search.md