52 Commits

Author SHA1 Message Date
Oleh Prypin
f40f3bfe92 Move CONTRIBUTING.md doc to the root 2023-12-10 10:41:22 +01:00
Oleh Prypin
8353493606 Use YAML indentation width of 2 spaces (#3287) 2023-07-09 15:59:51 +02:00
Oleh Prypin
b162c5e824 Docs: automatically generate the list of locales (#3272) 2023-06-23 09:35:26 +02:00
Muescha
635dfc1a33 Docs: fix twitter link in the footer (#3094) 2023-04-21 22:15:26 +02:00
Oleh Prypin
b2083d07f5 Add CLI reference page, auto-generated from Click (#2996) 2022-10-08 11:17:05 +02:00
Oleh Prypin
927ee2684b Release 1.4.0 (#2986) 2022-09-27 19:26:54 +02:00
Oleh Prypin
8dfef829b8 Enable <details> admonitions and nested codeblocks 2022-09-19 22:22:12 +02:00
Oleh Prypin
cf8a07475f Deduplicate the nav specification with literate-nav 2022-09-18 18:47:54 +02:00
Oleh Prypin
9c0a8e50b1 Move some documentation into code, add misc API docs page (#2934) 2022-08-17 18:07:10 +02:00
Oleh Prypin
12841f1aa5 Add type annotations for plugin events, include them in the docs 2022-08-14 18:33:36 +02:00
Oleh Prypin
f79b34d174 Move plugin events docs into source code + refactor
* Create real (no-op) methods for each event in the base class.
* Refactor event dispatcher to not check for methods' existence, instead just call them.
* Move documentation from Markdown into docstrings of these methods.
* Activate the 'mkdocstrings' plugin.
* Use 'mkdocstrings' to insert documentation from those docstrings into the site.
2022-08-14 18:33:36 +02:00
Oleh Prypin
af8342e90b Enable "Edit on GitHub" for own site 2022-08-13 12:18:49 +02:00
Oleh Prypin
f5777a915a Docs: add a diagram with relations between all the plugin events (#2387) 2022-08-07 15:05:44 +02:00
Oleh Prypin
22af92c874 Migrate docs from "admonition" to "callouts" extension (#2684)
The result is exactly equivalent, just different syntax -- one that doesn't look weird in vanilla Markdown parsers such as on GitHub.
The output HTML before/after is equivalent , other than adding `<p class="admonition-title">Block</p>` in two cases, which I hid with CSS.

This also contributes to fixing the currently-present markdownlint MD053 violations, as it can't scan inside admonitions.

Add 'markdown-callouts' to dependencies and bump Markdown dep.
2022-08-06 17:35:36 +02:00
Waylan Limberg
80feaf03a4 Deprecate google_analytics config option.
A new replacement option (theme.analytics.gtag) was added to the built-in themes. Multiple different services could be offered under theme.analytics. At this time only support for gtag exists, but more could be added in the future.

Fixes #2252.
2021-06-02 11:02:01 -04:00
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
d99419ac44 Ensure site_url ends with a slash
`urlparse(config['site_url']).path` can be empty if `site_url` does not end
in a slash. This ensures at least a slash is returned. Config validation
will add the slash if it is missing. Fixes #1785.
2021-04-10 18:43:13 -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
Christian Oliff
074f119802 Https link 2018-08-11 08:44:34 -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
Waylan Limberg
34ef3ca6d0 Internal Refactor of Pages, Files, and Navigation (#1504)
Internal handling of pages, files and navigation has been completely refactored.
The changes included in the refactor are summarized below.

* Support for hidden pages. All Markdown pages are now included in the build
  regardless of whether they are included in the navigation configuration
  (fixes #699).
* The navigation can now include links to external sites (fixes #989, fixes #1373,
  & fixes #1406).
* Page data (including titles) is properly determined for all pages before any
  page is rendered (fixes #1347).
* Automatically populated navigation now sorts index pages to the top. In other
  words, The index page will be listed as the first child of a directory, while
  all other documents are sorted alphanumerically by file name after the index
  page (fixes #73 & fixes #1042).
* A `README.md` file is now treated as an index file within a directory and
  will be rendered to `index.html` (fixes #608).
* The URLs for all files are computed once and stored in a files collection.
  This ensures all internal links are always computed correctly regardless of
  the configuration. This also allows all internal links to be validated, not
  just links to other Markdown pages. (fixes #842 & fixes #872).
* An `on_files` plugin event has been added, which could be used to include
  files not in the `docs_dir`, exclude files, redefine page URLs (i.e.
  implement extensionless URLs), or to manipulate files in various other ways.

Backward incompatible changes are highlighted in the release notes included 
with this commit. Some notes regarding various decisions follow in no particular 
order:

This started out as the contents of the 'structure' dir from @tomchristie's 
work in #689.

All paths must be all Unicode all the time. When a byte string and a 
Unicode string are both passed to os.path (join ect) then returned value 
is always a byte string. Therefore, we need every path string to be 
Unicode. This ensures validation checks that and if the byte string uses 
the file system encoding, decodes it. For any other encoding, a 
validation error is raised.

Paths which start with a slash are assumed to be relative to the
docs_dir root. This behavior fixes #192. However, the slash not being
present in the output may surprise some users who are trying to create a
link relative to the server root when the mkdocs root is not at the
server root. The URLs available on a page are:

* Page.url is the url relative to the site_dir
* Page.canonical_url is the relative url joined with site_url or None if
  site_url is not defined (the default).
* Page.abs_url is the path component of the canonical url or None if
  canonical_url is None.

Note that new behavior is slightly different than before. Previously
abs_url ignored site_url and was always url with '' prepended. With the
new behavior, if site_url includes a subdir, that subdir will be
included in the abs_url.

When not on a server, there is no sensable "absolute_url" for a page.
Therefore, we shouldn't try to define one.

The thinking is that users generating docs to be browsed in the local
file system (`file://`) should leave the site_url setting unset, while
users who will be serving their docs from a server should be setting the
site_url. And if the site_url point sot a subdir of the server, the
abs_url will stil be absolute from the server root as it uses the "path"
of the canonical_url of the page.

Note that without the magical url context all URLs must be prepended by
`{{ base_url }}/` in the templates. While this requires a change in
third party themes, it is more consistent.

Links being ignored in raw HTML is now documented. Fixes #991.

All related tests that require temp dirs use the `mkdocs.tests.base.tempdir`
decorator. Note that any unrelated tests have not yet been updated. 
That can happen separately from this. The one test in 
`mkdocs.tests.structure.page_tests` (test_BOM) is unique enough to 
not use the decorator.
2018-06-28 15:08:17 -04:00
Waylan Limberg
5ee6600c95 Link to GitHub issues from release notes.
Uses the `mdx_gh_links` Markdown extension. Fixes #644.
2018-03-09 14:08:24 -05:00
Waylan Limberg
84ccafce22 Clean up YAML files. 2017-10-27 10:40:54 -04:00
Waylan Limberg
1477ea87be Some edit_uri tweaks.
* Improve documentation and ensure it matches actual behavior.
* Use `page.edit_url` not `config.edit_url` in mkdocs template (opps).
* Include whitespace between icon and label in mkdocs theme.
* Undefined `edit_uri` results in `page.edit_url = None` when not automated.
* Setting `edit_uri: ''` disables automatic edit_uri for GitHub & Bitbucket.
2017-10-19 14:47:17 -04:00
Waylan Limberg
31e7c29784 Set 'search' as a default plugin.
Maintains better backward-compatability. Documentation updated, including
how to override the default. Also renamed the entry_point to 'search'.
The lib is still 'legacy_search'. When a new/better search plugin is
developed, the `search` entry_point will be pointed there so the default
behavior will inlcude the upgrade and a new `entry_point` will be added
('legacy_search') which points to the old plugin for those who really want
it.
2017-10-12 16:12:40 -04:00
Waylan Limberg
ffae0ef89c The Plugin API. (#1223)
See the included documentation for a full explanation of the API.

Search has been removed and wrapped in a plugin (named "legacy_search").
The search feature was ported as-is. None of the open issues with search
have been addressed. Presumably, a new search plugin will be built from
the ground up which addresses those issues.

Note that there is no 'default' plugins. That means that users get no
search unless they enable it in the config by adding the following to
their `mkdocs.yml` file:

    plugins:
        - legacy_search

Fixes #206
2017-10-01 16:48:47 -04:00
Nick Volynkin
2e07efacac fix the link to Tom Christie in the copyright notice 2017-04-07 10:55:47 +07:00
Waylan Limberg
ea02a2eea3 Deprecate auto-populating extra_css/javascript. 2016-08-09 22:50:35 -04:00
Dougal Matthews
4bb605c6cb Add a note about the MkDocs team members.
We never explicitly listed people before, this should make it
clearer who is behind the project.

Fixes #950
2016-06-28 20:59:34 +01:00
Dougal Matthews
44fc6d9230 Added docuementation for packaging themes 2015-06-27 11:03:30 +01:00
Dougal Matthews
e16f9384ea Add site_author and site_description to the ReadTheDocs theme
Fixes #631
2015-06-16 09:24:26 +01:00
Dougal Matthews
77216f4c7e Revert to manually defining the Pages so we can order them 2015-06-12 13:08:49 +01:00
Dougal Matthews
d1a19a00a1 Deprecate non-behaviourable config options
This change adds the ability to validate nested properties, such as
those within 'extra' and provides a deprecated config option for those
that have been moved.
2015-05-24 10:26:57 +01:00
Waylan Limberg
a6fc4f9420 Refactor Markdown Extension Options Config.
Config validation now handles all extension processing:

* Builtin extensions are defined and within the default scheme.
* User extensions are defined only as a list in the config. Note, this is
  a backward incompatable change from the previous (short-lived) release.
* The users extensions are added to the list of builtins.
* Any duplicates are accounted for in validation.
* Extension options are supported by a child key/value pair on the ext name.
* All extension options are compiled into a format Markdown accepts
  within the validation process and are saved to the internal `mdx_configs`
  config setting.
* The `mdx_configs` setting is private and raises an error if set by the user.
* A whole suite of tests were added to test all aspects of ext validation.

All relevant build tests were updated to pass the config to
`build.convert_markdown` as the config now handles all extension data.

The relevant documentation was updated to reflect the changes. While I was
at it, I spellchecked the entire document and made a few additional formatting
changes.

This fixes #519 plus a lot more.
2015-05-16 10:40:55 -04:00
Dougal Matthews
984029ab52 Update auto pages configuration under the new nested Navigation structure.
Fixes #499
2015-05-06 14:21:33 +01:00
Dougal Matthews
8085c65c6a Refactor the pages configuration
The current pages configuration looks like this:

    pages:
    - ['index.md', 'Home']
    - ['writing-your-docs.md', 'User Guide', 'Writing your docs']
    - ['styling-your-docs.md', 'User Guide', 'Styling your docs']
    - ['configuration.md', 'User Guide', 'Configuration']
    - ['about/license.md', 'About', 'License']
    - ['about/release-notes.md', 'About', 'Release Notes']
    - ['about/contributing.md', 'About', 'Contributing']

This has a number of flaws:

- It isn't clear how to add second levels of navigation for
  newcomers. This is often queried and not easy to document.

- We are representing a tree structure as a set of flat items
  that need to be merged. This creates some interesting edge
  cases, for example:

    - ['writing-your-docs.md', 'User Guide']
    - ['styling-your-docs.md', 'User Guide', 'Styling your docs']

 Is the first entry a page with the title User Guide? or a page
 in the User Guide category with an automatic title.

- We are currently limited to two levels deep in the navigation.
  Changing this with the current structure isn't trivial.

This change adds a new format which makes the above configuration
look like this:

    pages:
    - Home: index.md
    - User Guide:
        - user-guide/writing-your-docs.md
        - user-guide/styling-your-docs.md
        - user-guide/configuration.md
    - About:
        - License: about/license.md
        - about/release-notes.md
        - Contributing: about/contributing.md

With this structure, we can more easily see the documentation
tree and it is far more obvious what the navigation will look
like. It also removes the ambiguous edge cases and opens up the
possibility of adding further levels to the navigation more
easily.

This change restructures the pages configuration, but doesn't yet
allow users to add further levels in the navigation.

Fixes #6
2015-05-05 08:38:18 +01:00
Dougal Matthews
b5bd1c7f0b Add building extra templates
This is similar to extra_css and extra_javascript except it picks up
HTML and XML files and runs them through jinja2 with the global context.
This adds for quite a bit of flexability and allows people to easily add
custom site maps, static and templates htlp.

Fixes #28
Fixes #44
2015-04-28 20:43:19 +01:00
Dougal Matthews
835c27b5b2 Add details about implementing search in a custom theme 2015-04-25 10:03:47 +01:00
Dougal Matthews
621f38c9ff Enable permalinks in the MkDocs docs.
They were used a bit in the previous doc additions, so makes sense to
add them.
2015-04-24 20:44:18 +01:00
Dougal Matthews
0fc7ea5bc5 Update links to go directly to the organisation GitHub 2015-04-04 14:10:26 +01:00
Dougal Matthews
bdbf2ce5ed Added an initial Contributing guide 2015-04-03 14:47:00 +01:00
Dougal Matthews
e1366d0a18 Initial release notes 2014-10-09 09:47:38 +01:00
Tom Christie
b7dc915716 Tidy up config. 2014-03-30 16:02:55 +01:00
Tom Christie
ba8212f14d Fix google analytics code 2014-02-26 09:30:18 +00:00
Tom Christie
5c54f73619 Version 0.5 2014-02-26 09:26:55 +00:00
Tom Christie
0303e87a1d MkDocs theme becomes built-in 2014-02-05 09:30:50 +00:00
Tom Christie
e530965075 Theme & build tweaks 2014-02-03 17:10:34 +00:00
Tom Christie
b10bf24f74 pages -> list, instead of '/' delimited 2014-02-03 09:10:49 +00:00
Tom Christie
42bd5affac Refactoring + getting context/config properly sorted 2014-02-01 22:22:43 +00:00
Tom Christie
6b3f83bfe3 Use custom cerulean-based theme 2014-01-29 20:06:13 +00:00