@@ -203,22 +203,57 @@ A demo is worth a thousand words — check it out at
203203 [11] : ../assets/screenshots/search-highlighting.png
204204 [12] : https://squidfunk.github.io/mkdocs-material-insiders/reference/code-blocks/?h=code+blocks
205205
206+ # ## Search sharing
207+
208+ [:octicons-file-code-24 : Source][8] ·
209+ :octicons-unlock-24 : Feature flag ·
210+ :octicons-beaker-24 : Experimental ·
211+ [:octicons-heart-fill-24:{ : .tx-heart } Insiders only][8]{: .tx-insiders }
212+
213+ When _search sharing_ is activated, a :material-share-variant : share button is
214+ rendered next to the reset button, which allows to deep link to the current
215+ search query and result. It can be enabled via `mkdocs.yml` with :
216+
217+ ` ` ` yaml
218+ theme:
219+ features:
220+ - search.share
221+ ` ` `
222+
223+ When a user clicks the share button, the URL is automatically copied to the
224+ clipboard.
225+
226+ <figure markdown="1">
227+
228+ [![Search sharing][13]][13]
229+
230+ <figcaption markdown="1">
231+
232+ A demo is worth a thousand words — check it out at
233+ [squidfunk.github.io/mkdocs-material-insiders][14]
234+
235+ </figcaption>
236+ </figure>
237+
238+ [13] : ../assets/screenshots/search-share.png
239+ [14] : https://squidfunk.github.io/mkdocs-material-insiders/setup/setting-up-site-search/?q=share+search
240+
206241# ## Offline search
207242
208- [:octicons-file-code-24 : Source][13 ] ·
209- [:octicons-cpu-24 : Plugin][14 ] · :octicons-beaker-24: Experimental
243+ [:octicons-file-code-24 : Source][15 ] ·
244+ [:octicons-cpu-24 : Plugin][16 ] · :octicons-beaker-24: Experimental
210245
211246If you distribute your documentation as `*.html` files, the built-in search
212247will not work out-of-the-box due to the restrictions modern browsers impose for
213- security reasons. This can be mitigated with the [localsearch][14 ] plugin in
214- combination with @squidfunk's [iframe-worker][15 ] polyfill.
248+ security reasons. This can be mitigated with the [localsearch][16 ] plugin in
249+ combination with @squidfunk's [iframe-worker][17 ] polyfill.
215250
216- For setup instructions, refer to the [official documentation][16 ].
251+ For setup instructions, refer to the [official documentation][18 ].
217252
218- [13 ] : https://github.com/squidfunk/mkdocs-material/blob/master/src/base.html
219- [14 ] : https://github.com/wilhelmer/mkdocs-localsearch/
220- [15 ] : https://github.com/squidfunk/iframe-worker
221- [16 ] : https://github.com/wilhelmer/mkdocs-localsearch#installation-material-v5
253+ [15 ] : https://github.com/squidfunk/mkdocs-material/blob/master/src/base.html
254+ [16 ] : https://github.com/wilhelmer/mkdocs-localsearch/
255+ [17 ] : https://github.com/squidfunk/iframe-worker
256+ [18 ] : https://github.com/wilhelmer/mkdocs-localsearch#installation-material-v5
222257
223258# # Customization
224259
@@ -232,12 +267,12 @@ your needs.
232267
233268# ## Query transformation
234269
235- [:octicons-file-code-24 : Source][17 ] ·
270+ [:octicons-file-code-24 : Source][19 ] ·
236271:octicons-mortar-board-24 : Difficulty: _easy_
237272
238273When a user enters a query into the search box, the query is pre-processed
239274before it is submitted to the search index. Material for MkDocs will apply the
240- following transformations, which can be customized by [extending the theme][18 ] :
275+ following transformations, which can be customized by [extending the theme][20 ] :
241276
242277` ` ` ts
243278/**
@@ -277,7 +312,7 @@ export function defaultTransform(query: string): string {
277312If you want to switch to the default behavior of the ` mkdocs ` or ` readthedocs `
278313template, both of which don't transform the query prior to submission, or
279314customize the ` transform ` function, you can do this by [ overriding the
280- ` config ` block] [ 19 ] :
315+ ` config ` block] [ 21 ] :
281316
282317``` html
283318{% block config %}
@@ -294,19 +329,19 @@ customize the `transform` function, you can do this by [overriding the
294329The ` transform ` function will receive the query string as entered by the user
295330and must return the processed query string to be submitted to the search index.
296331
297- [ 17 ] : https://github.com/squidfunk/mkdocs-material/blob/master/src/assets/javascripts/integrations/search/transform/index.ts
298- [ 18 ] : ../customization.md#extending-the-theme
299- [ 19 ] : ../customization.md#overriding-blocks
332+ [ 19 ] : https://github.com/squidfunk/mkdocs-material/blob/master/src/assets/javascripts/integrations/search/transform/index.ts
333+ [ 20 ] : ../customization.md#extending-the-theme
334+ [ 21 ] : ../customization.md#overriding-blocks
300335
301336### Custom search
302337
303- [ :octicons-file-code-24: Source] [ 20 ] ·
338+ [ :octicons-file-code-24: Source] [ 22 ] ·
304339:octicons-mortar-board-24: Difficulty: _ challenging_
305340
306- Material for MkDocs implements search as part of a [ web worker] [ 21 ] . If you
341+ Material for MkDocs implements search as part of a [ web worker] [ 23 ] . If you
307342want to switch the web worker with your own implementation, e.g. to submit
308343search to an external service, you can add a custom JavaScript file to the ` docs `
309- directory and [ override the ` config ` block] [ 19 ] :
344+ directory and [ override the ` config ` block] [ 21 ] :
310345
311346``` html
312347{% block config %}
@@ -323,8 +358,8 @@ message format using _discriminated unions_, i.e. through the `type` property
323358of the message. See the following interface definitions to learn about the
324359message formats:
325360
326- - [ :octicons-file-code-24: ` SearchMessage ` ] [ 22 ]
327- - [ :octicons-file-code-24: ` SearchIndex ` and ` SearchResult ` ] [ 23 ]
361+ - [ :octicons-file-code-24: ` SearchMessage ` ] [ 24 ]
362+ - [ :octicons-file-code-24: ` SearchIndex ` and ` SearchResult ` ] [ 25 ]
328363
329364The sequence and direction of messages is rather intuitive:
330365
@@ -333,7 +368,7 @@ The sequence and direction of messages is rather intuitive:
333368- :octicons-arrow-right-24: ` SearchQueryMessage `
334369- :octicons-arrow-left-24: ` SearchResultMessage `
335370
336- [ 20 ] : https://github.com/squidfunk/mkdocs-material/blob/master/src/assets/javascripts/integrations/search/worker
337- [ 21 ] : https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers
338- [ 22 ] : https://github.com/squidfunk/mkdocs-material/blob/master/src/assets/javascripts/integrations/search/worker/message/index.ts
339- [ 23 ] : https://github.com/squidfunk/mkdocs-material/blob/master/src/assets/javascripts/integrations/search/_/index.ts
371+ [ 22 ] : https://github.com/squidfunk/mkdocs-material/blob/master/src/assets/javascripts/integrations/search/worker
372+ [ 23 ] : https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers
373+ [ 24 ] : https://github.com/squidfunk/mkdocs-material/blob/master/src/assets/javascripts/integrations/search/worker/message/index.ts
374+ [ 25 ] : https://github.com/squidfunk/mkdocs-material/blob/master/src/assets/javascripts/integrations/search/_/index.ts
0 commit comments