Skip to content

Commit 8d2846f

Browse files
committed
Prepare 8.2.13+insiders-4.14.0 release
1 parent 3666d09 commit 8d2846f

File tree

7 files changed

+148
-3
lines changed

7 files changed

+148
-3
lines changed

CHANGELOG

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
mkdocs-material-8.2.13+insiders-4.14.0 (2022-05-05)
2+
3+
* Added Chinese language support to built-in search plugin
4+
* Fixed all-numeric page titles raising error in social plugin
5+
16
mkdocs-material-8.2.13 (2022-05-02)
27

38
* Fixed #3865: Tags index links to tagged pages 404 on Windows
+91
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
---
2+
template: overrides/blog.html
3+
title: Chinese search support
4+
description: >
5+
Insiders adds Chinese language support for the built-in search plugin – a
6+
feature that has been requested many times
7+
hide:
8+
- feedback
9+
---
10+
11+
# Chinese search support – 中文搜索​支持
12+
13+
__Insiders adds experimental Chinese language support for the [built-in search
14+
plugin] – a feature that has been requested for a long time given the large
15+
number of Chinese users.__
16+
17+
<aside class="mdx-author" markdown>
18+
![@squidfunk][@squidfunk avatar]
19+
20+
<span>__Martin Donath__ · @squidfunk</span>
21+
<span>
22+
:octicons-calendar-24: May 5, 2022 ·
23+
:octicons-clock-24: 5 min read ·
24+
[:octicons-tag-24: 8.2.13+insiders-4.14.0][insiders-4.14.0]
25+
</span>
26+
</aside>
27+
28+
[built-in search plugin]: ../../setup/setting-up-site-search.md#built-in-search-plugin
29+
[@squidfunk avatar]: https://avatars.githubusercontent.com/u/932156
30+
[insiders-4.14.0]: ../../insiders/changelog.md#4.14.0
31+
32+
---
33+
34+
After the United States and Germany, the third-largest country of origin of
35+
Material for MkDocs users is China. For a long time, the built-in search plugin
36+
didn't allow for proper segmentation of Chinese characters, mainly due to
37+
missing support in [lunr-languages] which is used for search tokenization and
38+
stemming. The latest Insiders release adds long-awaited Chinese language support
39+
for the built-in search plugin, something that has been requested by many users.
40+
41+
_Material for MkDocs終於​支持​中文​了!文本​被​正確​分割​並且​更​容易​找到。_
42+
{ style="display: inline" }
43+
44+
_This article explains how to set up Chinese language support for the built-in
45+
search plugin in a few minutes._
46+
{ style="display: inline" }
47+
48+
[lunr-languages]: https://github.com/MihaiValentin/lunr-languages
49+
50+
## Configuration
51+
52+
Chinese language support for Material for MkDocs is provided by [jieba], an
53+
excellent Chinese text segmentation library. If [jieba] is installed, the
54+
built-in search plugin automatically detects Chinese characters and runs them
55+
through the segmenter. You can install [jieba] with:
56+
57+
```
58+
pip install jieba
59+
```
60+
61+
The next step is only required if you specified the [separator] configuration
62+
in `mkdocs.yml`. Text is segmented with [zero-width whitespace] characters, so
63+
it renders exactly the same in the search modal. Adjust `mkdocs.yml` so that
64+
the [separator] includes the `\u200b` character:
65+
66+
``` yaml
67+
plugins:
68+
- search:
69+
separator: '[\\s\\u200b\\-]'
70+
```
71+
72+
That's all that is necessary.
73+
74+
## Usage
75+
76+
If you followed the instructions in the configuration guide, Chinese words will
77+
now be tokenized using [jieba]. Try searching for
78+
[:octicons-search-24: 支持][q=支持] to see how it integrates with the
79+
built-in search plugin.
80+
81+
---
82+
83+
Note that this is an experimental feature, and I, @squidfunk, am not
84+
proficient in Chinese (yet?). If you find a bug or think something can be
85+
improved, please [open an issue].
86+
87+
[jieba]: https://pypi.org/project/jieba/
88+
[zero-width whitespace]: https://en.wikipedia.org/wiki/Zero-width_space
89+
[separator]: ../../setup/setting-up-site-search.md#separator
90+
[q=支持]: ?q=支持
91+
[open an issue]: https://github.com/squidfunk/mkdocs-material/issues/new/choose

docs/blog/index.md

+34-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,40 @@ search:
1313

1414
# Blog
1515

16+
## [Chinese search support – 中文搜索​支持]
17+
18+
__Insiders adds experimental Chinese language support for the [built-in search
19+
plugin] – a feature that has been requested for a long time given the large
20+
number of Chinese users.__
21+
22+
<aside class="mdx-author" markdown>
23+
![@squidfunk][@squidfunk avatar]
24+
25+
<span>__Martin Donath__ · @squidfunk</span>
26+
<span>
27+
:octicons-calendar-24: May 5, 2022 ·
28+
:octicons-clock-24: 5 min read ·
29+
[:octicons-tag-24: 8.2.13+insiders-4.14.0][insiders-4.14.0]
30+
</span>
31+
</aside>
32+
33+
---
34+
35+
After the United States and Germany, the third-largest country of origin of
36+
Material for MkDocs users is China. For a long time, the built-in search plugin
37+
didn't allow for proper segmentation of Chinese characters, mainly due to
38+
missing support in [lunr-languages] which is used for search tokenization and
39+
stemming. The latest Insiders release adds long-awaited Chinese language support
40+
for the built-in search plugin, something that has been requested by many users.
41+
42+
[:octicons-arrow-right-24: Continue reading][Chinese search support – 中文搜索​支持]
43+
44+
[built-in search plugin]: ../setup/setting-up-site-search.md#built-in-search-plugin
45+
[@squidfunk avatar]: https://avatars.githubusercontent.com/u/932156
46+
[insiders-4.14.0]: ../insiders/changelog.md#4.14.0
47+
[lunr-languages]: https://github.com/MihaiValentin/lunr-languages
48+
[Chinese search support – 中文搜索​支持]: 2022/chinese-search-support.md
49+
1650
## [The past, present and future]
1751

1852
__2021 was a fantastic year for this project as we shipped many new awesome
@@ -29,8 +63,6 @@ project sustainable.__
2963
</span>
3064
</aside>
3165

32-
[@squidfunk avatar]: https://avatars.githubusercontent.com/u/932156
33-
3466
---
3567

3668
Today, together, MkDocs and Material for MkDocs are among the most popular

docs/insiders/changelog.md

+5
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ template: overrides/main.html
66

77
## Material for MkDocs Insiders
88

9+
### 4.14.0 <small>_ May 5, 2022</small> { id="4.14.0" }
10+
11+
- Added Chinese language support to built-in search plugin
12+
- Fixed all-numeric page titles raising error in social plugin
13+
914
### 4.13.2 <small>_ April 30, 2022</small> { id="4.13.2" }
1015

1116
- Improved caching of downloaded resources in privacy plugin

docs/insiders/index.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,8 @@ which are currently exclusively available to sponsors:
174174

175175
<div class="mdx-columns" markdown>
176176

177-
- [x] [Tag icons] :material-new-box:
177+
- [x] [Chinese search support] :material-new-box:
178+
- [x] [Tag icons] :material-new-box:
178179
- [x] [Card grids] :material-new-box:
179180
- [x] [Offline plugin]
180181
- [x] [Privacy plugin]
@@ -262,12 +263,14 @@ are released for general availability.
262263
#### $ 12,000 – Piri Piri
263264

264265
- [x] [Annotations]
266+
- [x] [Chinese search support]
265267
- [x] [Navigation icons]
266268
- [ ] Navigation status badges
267269
- [ ] Navigation pruning
268270
- [ ] Blog
269271

270272
[Annotations]: ../reference/annotations.md
273+
[Chinese search support]: ../blog/2022/chinese-search-support.md
271274
[Navigation icons]: ../reference/index.md#setting-the-page-icon
272275

273276
#### $ 14,000 – Goat's Horn

docs/setup/setting-up-site-search.md

+7
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,12 @@ The following configuration options are supported:
9292
part of this list by automatically falling back to the stemmer yielding the
9393
best result.
9494

95+
!!! tip "Chinese search support – 中文搜索​支持"
96+
97+
Material for MkDocs recently added __experimental language support for
98+
Chinese__ as part of [Insiders]. [Read the blog article][chinese search]
99+
to learn how to set up search for Chinese in a matter of minutes.
100+
95101
`separator`{ #search-separator }
96102

97103
: :octicons-milestone-24: Default: _automatically set_ – The separator for
@@ -143,6 +149,7 @@ them at your own risk.
143149
[search support]: https://github.com/squidfunk/mkdocs-material/releases/tag/0.1.0
144150
[lunr]: https://lunrjs.com
145151
[lunr-languages]: https://github.com/MihaiValentin/lunr-languages
152+
[chinese search]: ../blog/2022/chinese-search-support.md
146153
[lunr's default tokenizer]: https://github.com/olivernn/lunr.js/blob/aa5a878f62a6bba1e8e5b95714899e17e8150b38/lunr.js#L413-L456
147154
[site language]: changing-the-language.md#site-language
148155
[tokenizer lookahead]: #tokenizer-lookahead

mkdocs.yml

+2
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,8 @@ nav:
217217
- Changelog: insiders/changelog.md
218218
- Blog:
219219
- blog/index.md
220+
- 2022:
221+
- blog/2022/chinese-search-support.md
220222
- 2021:
221223
- blog/2021/the-past-present-and-future.md
222224
- blog/2021/excluding-content-from-search.md

0 commit comments

Comments
 (0)