Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mkdocs-material
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Janne Mareike Koschinski
mkdocs-material
Commits
dcb0ee3f
Commit
dcb0ee3f
authored
8 years ago
by
squidfunk
Browse files
Options
Downloads
Patches
Plain Diff
Added documentation for site search localization
parent
271d9742
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
docs/getting-started.md
+53
-17
53 additions, 17 deletions
docs/getting-started.md
with
53 additions
and
17 deletions
docs/getting-started.md
+
53
−
17
View file @
dcb0ee3f
...
@@ -369,6 +369,8 @@ to the comments section. The necessary JavaScript is automatically included.
...
@@ -369,6 +369,8 @@ to the comments section. The necessary JavaScript is automatically included.
### Localization
### Localization
#### Translations
Material for MkDocs supports internationalization (i18n). In order to translate
Material for MkDocs supports internationalization (i18n). In order to translate
the labels (e.g.
*Previous*
and
*Next*
in the footer), you can override the
the labels (e.g.
*Previous*
and
*Next*
in the footer), you can override the
file
`partials/language.html`
and provide your own translations inside the
file
`partials/language.html`
and provide your own translations inside the
...
@@ -382,6 +384,7 @@ macro `t`:
...
@@ -382,6 +384,7 @@ macro `t`:
"footer.next"
:
"Next"
,
"footer.next"
:
"Next"
,
"meta.comments"
:
"Comments"
,
"meta.comments"
:
"Comments"
,
"meta.source"
:
"Source"
,
"meta.source"
:
"Source"
,
"search.languages"
:
""
,
"search.placeholder"
:
"Search"
,
"search.placeholder"
:
"Search"
,
"search.result.placeholder"
:
"Type to start searching"
,
"search.result.placeholder"
:
"Type to start searching"
,
"search.result.none"
:
"No matching documents"
,
"search.result.none"
:
"No matching documents"
,
...
@@ -396,8 +399,41 @@ Just copy the file from the original theme and make your adjustments. See the
...
@@ -396,8 +399,41 @@ Just copy the file from the original theme and make your adjustments. See the
section on
[
overriding partials
][
18
]
and the general guide on
section on
[
overriding partials
][
18
]
and the general guide on
[
theme extension
][
19
]
in the customization guide.
[
theme extension
][
19
]
in the customization guide.
#### Site search
Site search is implemented using
[
lunr.js
][
20
]
, which includes stemmers for the
English language by default. The community package
[
lunr-languages
][
21
]
adds
stemmers for other languages, which is also integrated with this theme. Support
for other languages and even multilingual search can be activated by setting
the key
`search.languages`
to a comma-separated list of supported 2-letter
language codes, e.g.:
```
jinja
{%
macro
t
(
key
)
%}{{
{
...
"search.placeholder"
:
"en, de, ru"
,
...
}
[
key
]
}}{%
endmacro
%}
```
This will automatically load the stemmers for the specified languages and
set them up with site search, nothing else to be done.
At the time of writing, the following languages are supported: English
`en`
,
French
`fr`
, Spanish
`es`
, Italian
`it`
, Japanese
`jp`
, Dutch
`du`
, Danish
`da`
,
Portguese
`pt`
, Finnish
`fi`
, Romanian
`ro`
, Hungarian
`hu`
, Russian
`ru`
,
Norwegian
`no`
, Swedish
`sv`
and Turkish
`tr`
.
!!! warning "Only specify the languages you really need"
Be aware that including suppport for other languages increases the general
JavaScript payload by around 20kb (without gzip) and by another 15-30kb per
language.
[
18
]:
customization.md#overriding-partials
[
18
]:
customization.md#overriding-partials
[
19
]:
customization.md#extending-the-theme
[
19
]:
customization.md#extending-the-theme
[
20
]:
https://lunrjs.com
[
21
]:
https://github.com/MihaiValentin/lunr-languages
### Tabs
### Tabs
...
@@ -415,13 +451,13 @@ extra:
...
@@ -415,13 +451,13 @@ extra:
### More advanced customization
### More advanced customization
If you want to change the general appearance of the Material theme, see
If you want to change the general appearance of the Material theme, see
[
this article
][
2
0
]
for more information on advanced customization.
[
this article
][
2
2
]
for more information on advanced customization.
[
2
0
]:
customization.md
[
2
2
]:
customization.md
## Extensions
## Extensions
MkDocs supports several
[
Markdown extensions
][
2
1
]
. The following extensions
MkDocs supports several
[
Markdown extensions
][
2
3
]
. The following extensions
are not enabled by default (see the link for which are enabled by default)
are not enabled by default (see the link for which are enabled by default)
but highly recommended, so they should be switched on at all times:
but highly recommended, so they should be switched on at all times:
...
@@ -435,20 +471,20 @@ markdown_extensions:
...
@@ -435,20 +471,20 @@ markdown_extensions:
For more information, see the following list of extensions supported by the
For more information, see the following list of extensions supported by the
Material theme including more information regarding installation and usage:
Material theme including more information regarding installation and usage:
*
[
Admonition
][
2
2
]
*
[
Admonition
][
2
4
]
*
[
Codehilite
][
2
3
]
*
[
Codehilite
][
2
5
]
*
[
Footnotes
][
2
4
]
*
[
Footnotes
][
2
6
]
*
[
Metadata
][
2
5
]
*
[
Metadata
][
2
7
]
*
[
Permalinks
][
2
6
]
*
[
Permalinks
][
2
8
]
*
[
PyMdown Extensions
][
2
7
]
*
[
PyMdown Extensions
][
2
8
]
[
2
1
]:
http://www.mkdocs.org/user-guide/writing-your-docs/#markdown-extensions
[
2
3
]:
http://www.mkdocs.org/user-guide/writing-your-docs/#markdown-extensions
[
2
2
]:
extensions/admonition.md
[
2
4
]:
extensions/admonition.md
[
2
3
]:
extensions/codehilite.md
[
2
5
]:
extensions/codehilite.md
[
2
4
]:
extensions/footnotes.md
[
2
6
]:
extensions/footnotes.md
[
2
5
]:
extensions/metadata.md
[
2
7
]:
extensions/metadata.md
[
2
6
]:
extensions/permalinks.md
[
2
8
]:
extensions/permalinks.md
[
2
7
]:
extensions/pymdown.md
[
2
9
]:
extensions/pymdown.md
## Full example
## Full example
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment