@@ -136,8 +136,7 @@ Use them at your own risk._
136
136
137
137
[:octicons-file-code-24 : Source][8] ·
138
138
:octicons-unlock-24 : Feature flag ·
139
- :octicons-beaker-24 : Experimental ·
140
- [:octicons-heart-fill-24:{ .mdx-heart } Insiders only][8]{ .mdx-insiders }
139
+ :octicons-beaker-24 : Experimental
141
140
142
141
When _search suggestions_ are enabled, the search will display the likeliest
143
142
completion for the last word, saving the user many key strokes by accepting the
@@ -155,16 +154,15 @@ Searching for [:octicons-search-24: ^^search su^^][9] yields ^^search suggestion
155
154
156
155
[![Search suggestions][10]][10]
157
156
158
- [8] : ../insiders/ index.md
157
+ [8] : https://github.com/squidfunk/mkdocs-material/blob/master/src/assets/javascripts/components/search/suggest/ index.ts
159
158
[9] : ?q=search+su
160
159
[10] : ../assets/screenshots/search-suggestions.png
161
160
162
161
# ## Search highlighting
163
162
164
- [:octicons-file-code-24 : Source][8 ] ·
163
+ [:octicons-file-code-24 : Source][11 ] ·
165
164
:octicons-unlock-24 : Feature flag ·
166
- :octicons-beaker-24 : Experimental ·
167
- [:octicons-heart-fill-24:{ .mdx-heart } Insiders only][8]{ .mdx-insiders }
165
+ :octicons-beaker-24 : Experimental
168
166
169
167
When _search highlighting_ is enabled and a user clicks on a search result,
170
168
Material for MkDocs will highlight all occurrences after following the link.
@@ -176,22 +174,22 @@ theme:
176
174
- search.highlight
177
175
` ` `
178
176
179
- Searching for [:octicons-search-24 : ^^code blocks^^][11 ] yields:
177
+ Searching for [:octicons-search-24 : ^^code blocks^^][12 ] yields:
180
178
181
- [![Search highlighting][12 ]][12 ]
179
+ [![Search highlighting][13 ]][13 ]
182
180
183
181
</figcaption>
184
182
</figure>
185
183
186
- [11] : ../reference/code-blocks.md?h=code+blocks
187
- [12] : ../assets/screenshots/search-highlighting.png
184
+ [11] : https://github.com/squidfunk/mkdocs-material/blob/master/src/assets/javascripts/components/search/highlight/index.ts
185
+ [12] : ../reference/code-blocks.md?h=code+blocks
186
+ [13] : ../assets/screenshots/search-highlighting.png
188
187
189
188
# ## Search sharing
190
189
191
- [:octicons-file-code-24 : Source][8 ] ·
190
+ [:octicons-file-code-24 : Source][14 ] ·
192
191
:octicons-unlock-24 : Feature flag ·
193
- :octicons-beaker-24 : Experimental ·
194
- [:octicons-heart-fill-24:{ .mdx-heart } Insiders only][8]{ .mdx-insiders }
192
+ :octicons-beaker-24 : Experimental
195
193
196
194
When _search sharing_ is activated, a :material-share-variant : share button is
197
195
rendered next to the reset button, which allows to deep link to the current
@@ -206,26 +204,27 @@ theme:
206
204
When a user clicks the share button, the URL is automatically copied to the
207
205
clipboard.
208
206
209
- [![Search sharing][13 ]][13 ]
207
+ [![Search sharing][15 ]][15 ]
210
208
211
- [13] : ../assets/screenshots/search-share.png
209
+ [14] : https://github.com/squidfunk/mkdocs-material/blob/master/src/assets/javascripts/components/search/share/index.ts
210
+ [15] : ../assets/screenshots/search-share.png
212
211
213
212
# ## Offline search
214
213
215
- [:octicons-file-code-24 : Source][14 ] ·
216
- [:octicons-cpu-24 : Plugin][15] · :octicons-beaker-24: Experimental
214
+ [:octicons-file-code-24 : Source][16 ] ·
215
+ [:octicons-cpu-24 : Plugin][17]
217
216
218
217
If you distribute your documentation as `*.html` files, the built-in search
219
218
will not work out-of-the-box due to the restrictions modern browsers impose for
220
- security reasons. This can be mitigated with the [localsearch][15 ] plugin in
221
- combination with @squidfunk's [iframe-worker][16 ] polyfill.
219
+ security reasons. This can be mitigated with the [localsearch][17 ] plugin in
220
+ combination with @squidfunk's [iframe-worker][18 ] polyfill.
222
221
223
- For setup instructions, refer to the [official documentation][17 ].
222
+ For setup instructions, refer to the [official documentation][19 ].
224
223
225
- [14 ] : https://github.com/squidfunk/mkdocs-material/blob/master/src/base.html
226
- [15 ] : https://github.com/wilhelmer/mkdocs-localsearch/
227
- [16 ] : https://github.com/squidfunk/iframe-worker
228
- [17 ] : https://github.com/wilhelmer/mkdocs-localsearch#installation-material-v5
224
+ [16 ] : https://github.com/squidfunk/mkdocs-material/blob/master/src/base.html
225
+ [17 ] : https://github.com/wilhelmer/mkdocs-localsearch/
226
+ [18 ] : https://github.com/squidfunk/iframe-worker
227
+ [19 ] : https://github.com/wilhelmer/mkdocs-localsearch#installation-material-v5
229
228
230
229
!!! tip
231
230
@@ -237,13 +236,13 @@ For setup instructions, refer to the [official documentation][17].
237
236
238
237
# ## Boosting a page
239
238
240
- [:octicons-file-code-24 : Source][8 ] ·
239
+ [:octicons-file-code-24 : Source][20 ] ·
241
240
:octicons-note-24 : Metadata ·
242
- [:octicons-heart-fill-24:{ .mdx-heart } Insiders only][8 ]{ .mdx-insiders }
241
+ [:octicons-heart-fill-24:{ .mdx-heart } Insiders only][20 ]{ .mdx-insiders }
243
242
244
243
In order to give specific pages a higher relevance in search, [lunr][4] supports
245
244
page-specific boosts, which can be defined for each page by leveraging the
246
- [Metadata][18 ] extension :
245
+ [Metadata][21 ] extension :
247
246
248
247
` ` ` bash
249
248
---
@@ -255,7 +254,8 @@ search:
255
254
...
256
255
` ` `
257
256
258
- [18] : ../../reference/meta-tags/#metadata
257
+ [20] : ../insiders/index.md
258
+ [21] : ../../reference/meta-tags/#metadata
259
259
260
260
# # Customization
261
261
@@ -269,12 +269,12 @@ your needs.
269
269
270
270
# ## Query transformation
271
271
272
- [:octicons-file-code-24 : Source][19 ] ·
272
+ [:octicons-file-code-24 : Source][22 ] ·
273
273
:octicons-mortar-board-24 : Difficulty: _easy_
274
274
275
275
When a user enters a query into the search box, the query is pre-processed
276
276
before it is submitted to the search index. Material for MkDocs will apply the
277
- following transformations, which can be customized by [extending the theme][20 ] :
277
+ following transformations, which can be customized by [extending the theme][23 ] :
278
278
279
279
` ` ` ts
280
280
export function defaultTransform(query: string): string {
@@ -307,7 +307,7 @@ export function defaultTransform(query: string): string {
307
307
If you want to switch to the default behavior of the `mkdocs` and `readthedocs`
308
308
themes, both of which don't transform the query prior to submission, or
309
309
customize the `transform` function, you can do this by [overriding the
310
- `config` block][21 ] :
310
+ `config` block][24 ] :
311
311
312
312
` ` ` html
313
313
{% block config %}
@@ -325,19 +325,19 @@ customize the `transform` function, you can do this by [overriding the
325
325
The `transform` function will receive the query string as entered by the user
326
326
and must return the processed query string to be submitted to the search index.
327
327
328
- [19 ] : https://github.com/squidfunk/mkdocs-material/blob/master/src/assets/javascripts/integrations/search/transform/index.ts
329
- [20 ] : ../customization.md#extending-the-theme
330
- [21 ] : ../customization.md#overriding-blocks-recommended
328
+ [22 ] : https://github.com/squidfunk/mkdocs-material/blob/master/src/assets/javascripts/integrations/search/transform/index.ts
329
+ [23 ] : ../customization.md#extending-the-theme
330
+ [24 ] : ../customization.md#overriding-blocks-recommended
331
331
332
332
# ## Custom search
333
333
334
- [:octicons-file-code-24 : Source][22 ] ·
334
+ [:octicons-file-code-24 : Source][25 ] ·
335
335
:octicons-mortar-board-24 : Difficulty: _challenging_
336
336
337
- Material for MkDocs implements search as part of a [web worker][23 ]. If you
337
+ Material for MkDocs implements search as part of a [web worker][26 ]. If you
338
338
want to switch the web worker with your own implementation, e.g. to submit
339
339
search to an external service, you can add a custom JavaScript file to the
340
- `docs` directory and [override the `config` block][20 ] :
340
+ `docs` directory and [override the `config` block][23 ] :
341
341
342
342
` ` ` html
343
343
{% block config %}
@@ -355,8 +355,8 @@ format using _discriminated unions_, i.e. through the `type` property of the
355
355
message. See the following interface definitions to learn about the message
356
356
formats :
357
357
358
- - [:octicons-file-code-24 : ` SearchMessage` ][24 ]
359
- - [:octicons-file-code-24 : ` SearchIndex` and `SearchResult`][25 ]
358
+ - [:octicons-file-code-24 : ` SearchMessage` ][27 ]
359
+ - [:octicons-file-code-24 : ` SearchIndex` and `SearchResult`][28 ]
360
360
361
361
The sequence and direction of messages is rather intuitive :
362
362
@@ -365,7 +365,7 @@ The sequence and direction of messages is rather intuitive:
365
365
- :octicons-arrow-right-24 : ` SearchQueryMessage`
366
366
- :octicons-arrow-left-24 : ` SearchResultMessage`
367
367
368
- [22 ] : https://github.com/squidfunk/mkdocs-material/blob/master/src/assets/javascripts/integrations/search/worker
369
- [23 ] : https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers
370
- [24 ] : https://github.com/squidfunk/mkdocs-material/blob/master/src/assets/javascripts/integrations/search/worker/message/index.ts
371
- [25 ] : https://github.com/squidfunk/mkdocs-material/blob/master/src/assets/javascripts/integrations/search/_/index.ts
368
+ [25 ] : https://github.com/squidfunk/mkdocs-material/blob/master/src/assets/javascripts/integrations/search/worker
369
+ [26 ] : https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers
370
+ [27 ] : https://github.com/squidfunk/mkdocs-material/blob/master/src/assets/javascripts/integrations/search/worker/message/index.ts
371
+ [28 ] : https://github.com/squidfunk/mkdocs-material/blob/master/src/assets/javascripts/integrations/search/_/index.ts
0 commit comments