Skip to content

Commit f147eb6

Browse files
committed
Added documentation for linking of content tabs
1 parent 285ad88 commit f147eb6

File tree

6 files changed

+60
-15
lines changed

6 files changed

+60
-15
lines changed

CHANGELOG

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
mkdocs-material-7.1.5+insiders.2.9.0 (2021-05-23)
2+
3+
* Added support for linking of content tabs
4+
15
mkdocs-material-7.1.5 (2021-05-19)
26

37
* Fixed #2655: Details breaking page margins on print
91.5 KB
Loading
89.4 KB
Loading

docs/insiders/changelog.md

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

77
## Material for MkDocs Insiders
88

9+
### 2.9.0 <small>_ May 23, 2021</small>
10+
11+
- Added support for linking of content tabs
12+
913
### 2.8.0 <small>_ May 12, 2021</small>
1014

1115
- Added support for boosting pages in search

docs/insiders/index.md

+11-9
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ The following features are currently exclusively available to sponsors:
111111

112112
<div class="mdx-columns" markdown="1">
113113

114+
- [x] [Linking content tabs :material-new-box:][32]
114115
- [x] [Boosting pages in search :material-new-box:][30]
115116
- [x] [Tags (with search integration) :material-new-box:][29]
116117
- [x] [Stay on page when switching versions][28]
@@ -199,18 +200,19 @@ the public for general availability.
199200
#### $ 8,000 – Scotch Bonnet
200201

201202
- [x] [Custom admonition icons][31]
202-
- [ ] Table of contents shows which sections have search results
203+
- [x] [Linking content tabs][32]
203204
- [ ] List of last searches
204205

205206
[31]: ../reference/admonitions.md#changing-the-icons
207+
[32]: ../reference/content-tabs.md#linking-content-tabs
206208

207209
#### Future
208210

209-
- [ ] [Material for MkDocs Live Edit][32]
211+
- [ ] [Material for MkDocs Live Edit][33]
210212
- [ ] New layouts and styles
211213
- [ ] Code block palette toggle
212214

213-
[32]: https://twitter.com/squidfunk/status/1338252230265360391
215+
[33]: https://twitter.com/squidfunk/status/1338252230265360391
214216

215217
### Goals completed
216218

@@ -265,10 +267,10 @@ implemented behind feature flags; all configuration changes are
265267
backward-compatible. This means that your users will be able to build the
266268
documentation locally with Material for MkDocs and when they push their changes,
267269
it can be built with Insiders (e.g. as part of GitHub Actions). Thus, it's
268-
recommended to [install Insiders][33] only in CI, as you don't want to expose
270+
recommended to [install Insiders][34] only in CI, as you don't want to expose
269271
your `GH_TOKEN` to users.
270272

271-
[33]: ../publishing-your-site.md#github-pages
273+
[34]: ../publishing-your-site.md#github-pages
272274

273275
### Terms
274276

@@ -277,7 +279,7 @@ commercial project. Can we use Insiders under the same terms and conditions?_
277279

278280
Yes. Whether you're an individual or a company, you may use _Material for MkDocs
279281
Insiders_ precisely under the same terms as Material for MkDocs, which are given
280-
by the [MIT license][34]. However, we kindly ask you to respect the following
282+
by the [MIT license][35]. However, we kindly ask you to respect the following
281283
guidelines:
282284

283285
- Please __don't distribute the source code__ of Insiders. You may freely use
@@ -288,7 +290,7 @@ guidelines:
288290
- If you cancel your subscription, you're removed as a collaborator and will
289291
miss out on future updates of Insiders. However, you may __use the latest
290292
version__ that's available to you __as long as you like__. Just remember that
291-
[GitHub deletes private forks][35].
293+
[GitHub deletes private forks][36].
292294

293-
[34]: ../license.md
294-
[35]: https://docs.github.com/en/github/setting-up-and-managing-your-github-user-account/removing-a-collaborator-from-a-personal-repository
295+
[35]: ../license.md
296+
[36]: https://docs.github.com/en/github/setting-up-and-managing-your-github-user-account/removing-a-collaborator-from-a-personal-repository

docs/reference/content-tabs.md

+41-6
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ template: overrides/main.html
66

77
Sometimes, it's desirable to group alternative content under different tabs,
88
e.g. when describing how to access an API from different languages or
9-
environments. Material for MkDocs allows for beautiful and functional tabs, grouping code blocks and other content.
9+
environments. Material for MkDocs allows for beautiful and functional tabs,
10+
grouping code blocks and other content.
1011

1112
## Configuration
1213

@@ -133,11 +134,45 @@ _Result_:
133134
2. Donec vitae suscipit est
134135
3. Nulla tempor lobortis orci
135136

137+
### Linking content tabs
138+
139+
[:octicons-file-code-24: Source][5] ·
140+
:octicons-beaker-24: Experimental ·
141+
[:octicons-heart-fill-24:{ .mdx-heart } Insiders only][5]{ .mdx-insiders }
142+
143+
When _linking_ is enabled, all content tabs on a page will be linked and show
144+
the same active tab when the user clicks on a label. Add the following lines
145+
to `mkdocs.yml`:
146+
147+
``` yaml
148+
theme:
149+
features:
150+
- content.tabs.link
151+
```
152+
153+
Content tabs are linked based on their label, not offset. This means that all
154+
tabs with the same label will be activated when a user clicks a content tab
155+
regardless of order inside a container. Furthermore, this feature is fully
156+
integrated with [instant loading][6] and persisted across page loads.
157+
158+
=== "With linking"
159+
160+
[![With linking][7]][7]
161+
162+
=== "Without linking"
163+
164+
[![Without linking][8]][8]
165+
166+
[5]: ../insiders/index.md
167+
[6]: ../setup/setting-up-navigation.md#instant-loading
168+
[7]: ../assets/screenshots/content-tabs-link.png
169+
[8]: ../assets/screenshots/content-tabs.png
170+
136171
### Embedded content
137172
138-
When [SuperFences][5] is enabled, content tabs can contain arbitrary nested
173+
When [SuperFences][9] is enabled, content tabs can contain arbitrary nested
139174
content, including further content tabs, and can be nested in other blocks like
140-
[admonitions][6], [details][7] or blockquotes:
175+
[admonitions][10], [details][11] or blockquotes:
141176
142177
_Example_:
143178
@@ -213,6 +248,6 @@ _Result_:
213248
2. Donec vitae suscipit est
214249
3. Nulla tempor lobortis orci
215250

216-
[5]: #superfences
217-
[6]: admonitions.md
218-
[7]: admonitions.md#details
251+
[9]: #superfences
252+
[10]: admonitions.md
253+
[11]: admonitions.md#details

0 commit comments

Comments
 (0)