@@ -3,7 +3,6 @@ template: overrides/main.html
33description : >
44 Three new simple ways to exclude dedicated parts of a document from the search
55 index, allowing for more fine-grained control
6- disqus : mkdocs-material
76search :
87 exclude : true
98---
@@ -15,7 +14,7 @@ dedicated parts of a document from the search index, allowing for more
1514fine-grained control.__
1615
1716<aside class =" mdx-author " markdown >
18- ![ @squidfunk ] [ 1 ]
17+ ![ @squidfunk ] [ @squidfunk avatar ]
1918
2019<span >__ Martin Donath__ · @squidfunk </span >
2120<span >
@@ -25,32 +24,32 @@ fine-grained control.__
2524</span >
2625</aside >
2726
28- [ 1 ] : https://avatars.githubusercontent.com/u/932156
27+ [ @squidfunk avatar ] : https://avatars.githubusercontent.com/u/932156
2928
3029---
3130
3231Two weeks ago, Material for MkDocs Insiders shipped a [ brand new search
33- plugin] [ 2 ] , yielding [ massive improvements in usability] [ 3 ] , but also in [ speed
34- and size] [ 4 ] of the search index. Interestingly, as discussed in the previous
32+ plugin] , yielding [ massive improvements in usability] , but also in [ speed
33+ and size] of the search index. Interestingly, as discussed in the previous
3534blog article, we only scratched the surface of what's now possible. This
3635release brings some useful features that enhance the writing experience,
3736allowing for more fine-grained control of what pages, sections and blocks of a
3837Markdown file should be indexed by the built-in search functionality.
3938
4039_ The following section discusses existing solutions for excluding pages and
4140sections from the search index. If you immediately want to learn what's new,
42- skip to the [ section just after that] [ 5 ] ._
41+ skip to the [ section just after that] [ what's new ] ._
4342
44- [ 2 ] : search-better-faster-smaller.md
45- [ 3 ] : search-better-faster-smaller.md#whats-new
46- [ 4 ] : search-better-faster-smaller.md#benchmarks
47- [ 5 ] : #whats-new
43+ [ brand new search plugin ] : search-better-faster-smaller.md
44+ [ massive improvements in usability ] : search-better-faster-smaller.md#whats-new
45+ [ speed and size ] : search-better-faster-smaller.md#benchmarks
46+ [ what's new ] : #whats-new
4847
4948## Prior art
5049
51- MkDocs has a rich and thriving ecosystem of [ plugins] [ 6 ] , and it comes as no
50+ MkDocs has a rich and thriving ecosystem of [ plugins] , and it comes as no
5251surprise that there's already a fantastic plugin by @chrieke to exclude specific
53- sections of a Markdown file – the [ mkdocs-exclude-search] [ 7 ] plugin. It can be
52+ sections of a Markdown file – the [ mkdocs-exclude-search] plugin. It can be
5453installed with:
5554
5655```
@@ -78,10 +77,10 @@ adds support for advanced filtering techniques like infix- and suffix-filtering
7877using wildcards. While this is a very powerful idea, it comes with some
7978downsides:
8079
81- 1. __Exclusion patterns and content are not co-located__: exclusion patterns
82- need to be defined in ` mkdocs.yml`, and not as part of the respective
83- document or section to be excluded. This might result in stale exclusion
84- patterns, leading to unintended behavior :
80+ 1. __Exclusion patterns and content are not co-located__: exclusion patterns
81+ need to be defined in ` mkdocs.yml`, and not as part of the respective
82+ document or section to be excluded. This might result in stale exclusion
83+ patterns, leading to unintended behavior :
8584
8685 - When a headline is changed, its slug (permalink) also changes, which might
8786 suddenly match (or unmatch) a pattern, e.g., when an author fixes a typo
@@ -97,23 +96,23 @@ downsides:
9796 pages and sections have been excluded from the search index, but MkDocs will
9897 now flood the terminal with debug output from its core and other plugins.
9998
100- 2. __Exclusion control might be too coarse__ : The [mkdocs-exclude-search][7 ]
101- plugin only allows for the exclusion of pages and sections. It's not possible
102- to exclude parts of a section, e.g., content that is irrelevant to search but
103- must be included as part of the documentation.
99+ 2. __Exclusion control might be too coarse__ : The [mkdocs-exclude-search]
100+ plugin only allows for the exclusion of pages and sections. It's not
101+ possible to exclude parts of a section, e.g., content that is irrelevant
102+ to search but must be included as part of the documentation.
104103
105- [6 ] : https://github.com/mkdocs/mkdocs/wiki/MkDocs-Plugins
106- [7 ] : https://github.com/chrieke/mkdocs-exclude-search
104+ [plugins ] : https://github.com/mkdocs/mkdocs/wiki/MkDocs-Plugins
105+ [mkdocs-exclude-search ] : https://github.com/chrieke/mkdocs-exclude-search
107106
108107# # What's new?
109108
110109The latest Insiders release brings fine-grained control for [__excluding pages,
111- sections, and blocks__][8 ] from the search index, implemented through front
112- matter, as well as the [Attribute List][9] extension . Note that it doesn't
113- replace the [mkdocs-exclude-search][7] plugin but _complements_ it.
110+ sections, and blocks__][search exclusion ] from the search index, implemented
111+ through front matter, as well as the [Attribute Lists] . Note that it doesn't
112+ replace the [mkdocs-exclude-search] plugin but __complements__ it.
114113
115- [8 ] : ../../setup/setting-up-site-search.md#search-exclusion
116- [9 ] : https://python-markdown.github.io/ extensions/attr_list/
114+ [search exclusion ] : ../../setup/setting-up-site-search.md#search-exclusion
115+ [Attribute Lists ] : ../../setup/ extensions/python-markdown.md#attribute-lists
117116
118117# ## Excluding pages
119118
@@ -134,12 +133,12 @@ search:
134133
135134# ## Excluding sections
136135
137- If a section should be excluded, the author can use the [Attribute List][9 ]
136+ If a section should be excluded, the author can use the [Attribute Lists ]
138137extension to add a __pragma__ called `{ data-search-exclude }` at the end of a
139138heading. The pragma is not included in the final HTML, as search pragmas are
140139filtered by the search plugin before the page is rendered :
141140
142- === "` docs/page.md` "
141+ === ":octicons-file-code-16 : docs/page.md"
143142
144143 ` ` ` markdown
145144 # Document title
@@ -153,7 +152,7 @@ filtered by the search plugin before the page is rendered:
153152 The content of this section is excluded
154153 ` ` `
155154
156- === "` search_index.json` "
155+ === ":octicons-codescan-16 : search_index.json"
157156
158157 ` ` ` json
159158 {
@@ -176,10 +175,10 @@ filtered by the search plugin before the page is rendered:
176175# ## Excluding blocks
177176
178177If even more fine-grained control is desired, the __pragma__ can be added to
179- any [block-level element][10] or [inline-level element][11 ] that is officially
180- supported by the [Attribute List][9 ] extension :
178+ any [block-level element] or [inline-level element] that is officially
179+ supported by the [Attribute Lists ] extension :
181180
182- === "` docs/page.md` "
181+ === ":octicons-file-code-16 : docs/page.md"
183182
184183 ` ` ` markdown
185184 # Document title
@@ -190,7 +189,7 @@ supported by the [Attribute List][9] extension:
190189 { data-search-exclude }
191190 ` ` `
192191
193- === "` search_index.json` "
192+ === ":octicons-codescan-16 : search_index.json"
194193
195194 ` ` ` json
196195 {
@@ -205,12 +204,12 @@ supported by the [Attribute List][9] extension:
205204 }
206205 ` ` `
207206
208- [10 ] : https://python-markdown.github.io/extensions/attr_list/#block-level
209- [11 ] : https://python-markdown.github.io/extensions/attr_list/#inline-level
207+ [block-level element ] : https://python-markdown.github.io/extensions/attr_list/#block-level
208+ [inline-level element ] : https://python-markdown.github.io/extensions/attr_list/#inline
210209
211210# # Conclusion
212211
213212The latest release brings three simple ways to control more precisely what goes
214213into the search index and what doesn't. It complements the already very powerful
215- [mkdocs-exclude-search][7] plugin, allowing for new methods of shaping the
214+ [mkdocs-exclude-search] plugin, allowing for new methods of shaping the
216215structure, size and content of the search index.
0 commit comments