302 Commits

Author SHA1 Message Date
Ultrabug
e1b77ab66e Support theme localization
A framework for translating themes as been added, which includes:

1. Use of Jinja's `i18n` plugin for translating phrases in templates (not page content).
2. A French translation of the built-in themes (contributions in other languages are welcome).
3. A new `theme.locale` option to define the locale/language of the site.
4. The search plugin uses the value of `theme.locale` as its default 'lang'.
5. Third party themes may chose to use the framework (use is optional).
6. A documented workflow for translating MkDocs built-in themes.
7. Custom tooling for use by translators and theme devs.

The dependencies are not installed by default and are not needed to use MkDocs without translations. However, for anyone who wants to make use of the features, `pip install mkdocs[i18n]` will install all necessary dependencies.

Relates to #211.
2021-05-06 14:30:21 -04:00
Waylan Limberg
a118183f5e Refactor docs (#2344)
The homepage has been redesigned. The "Installation" and "Getting Started" sections were moved to their own respective pages. Then, the homepage was restyled so that the list of features appear as a grid of cards.

The developer specific pages were moved to a new section: `dev-guide`. Any old URLs redirect to the new ones.
2021-04-04 16:14:29 -04:00
Mick Orbik
4faa18d095 Added configuration for search indexing strategy (#2309)
Allows a user to supply a `indexing` configuration to the search
plugin which controls what to include in the search index (full,
sections, titles)
2021-02-21 15:05:14 -05:00
Timothée Mazzucotelli
3c9358bb6a Add plugin error exception and event
Related to #2082.
2020-12-23 19:23:31 -05:00
Waylan Limberg
f4de3c7387 Support Environment Variables in config file
Environment variables can be assigned as values in the configuration
file using the !ENV tag. Resolves #1954.

The behavior is defined in the third-party package pyyaml_env_tag:
https://github.com/waylan/pyyaml-env-tag
2020-12-23 13:02:21 -05:00
SaintMalik
bd73399f55 Fix broken url in docs
## Summary

Easy navigation and easy reading for others
2020-12-17 13:18:43 -05:00
PoojaChandak
eba0bc51e1 Update configuration.md
Observed a few changes. Suggesting the same.
2020-10-27 14:31:04 -04:00
Chris McCafferty
22537dabac Fix a typo 2020-10-27 14:29:41 -04:00
Justin M
b440c4b923 Fixing broken internal anchor link 2020-10-27 14:27:28 -04:00
Tim Vink
b97b658f7b Fix typo 2020-10-27 14:26:35 -04:00
Peter Bajurny
aba9dbffcf Fix relative link to Index Pages in Writing Your Docs help page
The link links to `index_pages` with an underscore but the page as currently rendered has that link as `index-pages` with a hyphen.
2020-10-27 14:22:54 -04:00
Tim Vink
2d9d565712 Add link to Jinja environment class
Helpful for plugin developers
2020-10-27 14:22:00 -04:00
Waylan Limberg
a4eb4eb42b Fix markdownlint test (#2095)
Travis only gives us Node.js version 8 so we must use an older
version of markdownlint. To declare a newer node.js version we
lose the ability to have Python as the lang and install tox.
If/when the default node version gets updated, remove the
version restriction on markdownlint.
2020-05-07 00:07:38 -04:00
Waylan Limberg
7b68f7b828 Pass builder to on_serve event.
Every call to `server.watch` requires `builder` to be passed in. If
users are to add their own watched files, then they need access to
`builder`. Fixes #1952.
2020-04-19 16:15:29 -04:00
Ofek Lev
afa18ae2c0 Fix typo 2020-04-12 17:40:37 -04:00
Jim Conner
2505a907f4 Add minimum search length configuration parameter.
Allow users to set their own minimum search term length.  Fixes #2014.
2020-03-16 14:35:06 -04:00
albandewilde
2b92209d12 Correct the block name of the search box in the doc
As mentionned here: https://github.com/mkdocs/mkdocs/issues/1142#issuecomment-282899537
I just correct the name in the documentation
2020-03-09 16:13:01 -04:00
Jim Porter
13337eba9f Nested dropdowns *are* supported in the mkdocs theme
Despite Bootswatch not supporting nested dropdowns, the theme-specific CSS for
the mkdocs theme does add support for it, so we can remove the warning from
the release notes.
2020-02-21 19:40:00 -05:00
Jim Porter
a7c349cffa Update to lunr-languages v1.4.0; resolves #1729
This renames the Dutch language code to `nl`, the Japanese code to `ja`, and
adds support for Arabic (`ar`) and Vietnamese (`vi`).
2020-02-21 19:08:35 -05:00
Jim Porter
37e645d623 Use toc_tokens to generate the TOC
This patch improves the consistency of TOC levels, so now the level is always
equal to the N in the `<hN>` tag. It also allows users of the MkDocs theme to
set the navigation depth to show in the TOC panel (defaulting to 2).
Resolves #1910 and resolves #770.
2020-02-17 17:27:12 -05:00
Waylan Limberg
44f3ae212d Ensure nested dot files in themes are ignored.
Also, document how all files within themes are treated by MkDocs.
Fixes #1981.
2020-02-12 18:35:14 -05:00
Maximilian Albert
d07f5288da Fix typo 2020-02-11 14:23:24 -05:00
Adam Twardoch
262c2b70f3 Links to the MkDocs Plugins wiki page, themes and plugins 2019-12-30 09:30:08 -05:00
Waylan Limberg
d8f8e5be3c Cleanup MarkdownLint issue in docs. 2019-12-20 09:55:19 -05:00
Waylan Limberg
c9032bd6bf Drop Python 2.7.
* Disable Linkchecker Test.
* Switch to unittest.mock in standard lib.
* Apply `pyupgrade --py3-plus`.
* Note: Using `builtins.open` mocks all calls to `open`, including test setup
(such as in `load_config`). Whereas, `path.to.namespace.open` only mocks
`open` in that namepsace. This all worked differently when we used `io.open`
as that wasn't a builtin to begin with. 
* Add a helpful error msg for PY2 users who use non-standard install methods.

Closes #1926.
2019-12-20 08:44:07 -05:00
Jim Porter
15e31f7e68 Add support for customizing navigation bar styles in the mkdocs theme 2019-12-16 15:55:09 -05:00
Waylan Limberg
8c8f7bb672 Document that dot files are ignored. (#1925)
Also added a few additional clarifications about how MkDocs handles files in the docs_dir.

Fixes #1924.
2019-12-11 15:55:14 -05:00
Dan Untenzu
f200a60060 Docs: Fix YAML syntax in examples
* Fix indentation
* Quote strings
2019-08-13 09:15:22 -04:00
Dan Untenzu
625e423b76 Docs: Clarify page title generation 2019-08-13 09:12:31 -04:00
Dan
b967d0184d Docs: Clarify supported header style
Only atx-style headers are supported for page titles,
not Setext styles.

Fixes #1837
2019-08-13 09:08:16 -04:00
Florimond Manca
a84b5a27df Fix broken readthedocs links 2019-06-23 18:58:11 -04:00
Waylan Limberg
9ae04213b9 Clarify mkdocs_theme.yml is ignored by theme.custom_dir
This only updates the documentation to better reflect actual behavior.
The config for `theme.custom_dir` is defined in the `theme` config
option of `mkdocs.yml`. Therefore, any `mkdocs_theme.yml` file within
a custom_dir is ignored.
2019-06-17 18:58:50 -04:00
devakker
32d2ed3bee Add warning to docs about usage of absolute paths in links.
Fixes #1757.
2019-03-07 09:52:08 -05:00
Terry Zhao
bebf3791aa docs(plugins.md): outdated docs (#1685) 2018-11-21 23:38:03 -05:00
Terry Zhao
1897177ab0 docs(plugins.md): fix typo
plugins.md:357

"The `post_template` event .." -> "The `post_page` event .."
2018-11-21 15:43:31 -05:00
Yeray Diaz Diaz
259c2b102b Use lunr.py for prebuilding indices (#1607) 2018-09-29 09:07:53 -04:00
Waylan Limberg
873b970f7f Update readthedocs theme with upstream (#1594)
Fixes #588 and fixes #1374.

# Some implementation notes:

## `include_homepage_in_sidebar` setting

Note that the homepage is always linked from the site_name above the 
search box. Therefore it does not need to also be in the nav tree.
In the upstream Sphinx theme, this is controlled when defining the 
toctree. However, Sphinx has a separate setting for identifying the 
"homepage". In MkDocs the homepage is identified as the first item in 
the `nav`. Therefore, without this setting you can't exclude the 
homepage from the sidebar like you can in Sphinx. With this setting we 
get feature parity.

## Nested sections

This output is a little weird as the section title is a link that does 
nothing when you click it. You need to click the `+` to expand the 
submenu. But that is what the upstream theme requires to work.
2018-09-27 13:19:17 -04:00
Zrss
3642c4e03e Document --dev-addr instead of --dev_addr (#1638)
Fixes #1637.
2018-09-25 09:51:05 -04:00
Waylan Limberg
e37d1c9b06 Example now matches actual usage.
As pointed out in #1633 the example of overriding a template block used an undefined block name. The example has been updated to use an actual block name.
2018-09-20 13:09:25 -04:00
Jon Dufresne
fc53f1932e Prefer https:// URLs where available 2018-09-18 11:21:13 -04:00
Waylan Limberg
1739e708f5 Fix typo 2018-08-27 13:08:20 -04:00
Waylan Limberg
f13bf0148a Remove reference to now deprecated template vars (#1610)
Fixes #1608.
2018-08-27 11:00:51 -04:00
c-bb
c16ea3ae77 writing-your-docs.md: fix typo 2018-08-24 10:52:52 -04:00
Waylan Limberg
c872896c49 Exclude README.md if index.md is present. (#1582)
Also properly sort READMEs.

Fixes #1580
2018-08-08 10:25:38 -04:00
coliff
b4b49a1f52 HTTPS Links 2018-07-19 11:53:56 -04:00
Waylan Limberg
06608e98a7 Add hljs_style config to mkdocs theme.
This is primarily to allow third party themes which inherit from the 
mkdocs theme (such as the bootswatch themes) to alter the code 
highlighting style. Previously all of the themes hosted their own 
highlighting styles, but now that we are using the CDN, it is easier to 
use a setting, which downstream themes can override.
2018-07-17 16:14:45 -04:00
Waylan Limberg
21449eeea8 Don't conflict with accessibility shortcuts.
In both built-in themes, the default next/prev shortcut keys were
changed from arrows to n/p as the arrows conflict with common browser
accessibility extensions.

In the mkdocs theme,  users can now configure the shortcuts to whatever
they want. Note that these config options are theme specific. The
readthedocs theme does not get these options as they are not available
on the parent theme.

Fixes #1502
2018-07-13 17:40:31 -04:00
Waylan Limberg
da92f72ec8 Add support for YAML meta data. (#1542)
If the frontmatter is surrounded by YAML deliminators, then it is parsed 
as YAML. Otherwise it is parsed as MultiMarkdown meta-data and each 
value is returned as a joined string.

Closes #1471.
2018-07-11 13:18:20 -04:00
Dmitry Shachnev
67630d888b docs: Replace RTD screenshot with a working one. (#1505)
The remotely linked image was removed in rtfd/readthedocs.org#3438.

Turns out we already have a local image we can use.
2018-07-05 16:35:18 -04:00
Waylan Limberg
2e9de0a297 Add a highlightjs config setting (#1533)
The built-in themes now include support for enabling/disabling
highlight.js. They also use a CDN to load the files. As the CDN only
includes 23 languages, a second setting to support more languages
is included.

If a user wishes to use a different tool for highlighting, they can
"disable" highlight.js and then use extra_css and/or extra_javasript
to add support for their tool of choice.
2018-07-05 13:47:16 -04:00