Commit Graph

1338 Commits

Author SHA1 Message Date
Yeray Diaz Diaz
7aaf5a685c Prevent pressing Enter in search box from reloading the page 2018-08-12 20:03:08 -04:00
Yeray Diaz Diaz
24d61cec13 Avoid calling search until all assets, worker or otherwise, are ready 2018-08-12 20:03:08 -04:00
Christian Oliff
074f119802 Https link 2018-08-11 08:44:34 -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
Waylan Limberg
4076d7de43 Fix RTD Navigation bug.
Fixes #1575.
2018-08-03 20:43:29 -04:00
Waylan Limberg
8bd00d5f91 markdownlint cleanup 1.0 2018-08-03 10:26:40 -04:00
Waylan Limberg
1f41f33eae Upped version 1.0 Final! 2018-08-03 10:26:40 -04:00
David Fischer
a5420be30d Add a ReadTheDocs yaml config file 2018-07-28 18:54:13 -04:00
Waylan Limberg
30cdf59077 Up version to 1.0rc1 1.0rc1 2018-07-27 11:20:48 -04:00
Waylan Limberg
a11437e8cb Use DEBUG log level for external links in nav.
Fixes #1564.
2018-07-23 14:33:39 -04:00
Waylan Limberg
cd5c80375c Up version to 1.0b1 1.0b1 2018-07-20 14:00:06 -04:00
coliff
6c097ecbdb Losslessly optimize images with gulp-imagemin
Saved 197KB (38%)
2018-07-19 11:53:56 -04:00
coliff
b4b49a1f52 HTTPS Links 2018-07-19 11:53:56 -04:00
Christian Oliff
39dc230b6d HTTPS links to www.mkdocs.org (#1558) 2018-07-19 10:04:00 -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
Christian Oliff
8f94fa9b4d HTTPS links (#1554)
HTTPS link to MkDocs site
Always load highlight.js over HTTPS
2018-07-17 11:47:28 -04:00
Waylan Limberg
5ff7ee32fa Up version to 1.0a1 1.0a1 2018-07-13 20:56:14 -04:00
Waylan Limberg
19e24350f2 Switch Markdown linter to node based markdownlint-cli.
I've prefered the node based linter to the ruby one, but it didn't have
a CLI until recently. Also the config file is in an easier format.
2018-07-13 20:13:50 -04:00
Waylan Limberg
5ebcb5d1ca Set MarkdownLint list indent level to 4 2018-07-13 17:40:31 -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
Jon Dufresne
27f06517db Run Travis tests on PY37 rather than PY37-dev (#1547) 2018-07-12 20:18:33 -04:00
Waylan Limberg
b89d309c5f User friendly YAML parse errors.
This provides a clearer error for users who have an invalid config file. 
Partially addresses #1543.
2018-07-12 16:17:24 -04:00
Waylan Limberg
7c0d0b7624 Add official support for PY37. (#1545)
* Use Python 3.7-dev in Travis until they add official support for PY37.
* PY37 requires PyYAML 3.13+.
2018-07-12 15:24:19 -04:00
Waylan Limberg
c99ea4e250 Missing theme config file raises an error.
Previously a warning was raised and the build proceeded.
2018-07-11 14:54:58 -04:00
Waylan Limberg
ad867796eb theme_dir config fully Deprecated.
An error is now raised if the option is defined.
2018-07-11 14:54:58 -04:00
Waylan Limberg
d0c67b849c Empty extra_css and extra_javascript settings no longer raise a warning.
This fully deprecates autopopulating those settings.
2018-07-11 14:54:58 -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
Waylan Limberg
5c261d250f Include all blocks in base template: mkdocs theme.
Fixes #1142 for mkdocs theme. RTD theme will be addressed with #588.
2018-07-10 14:12:14 -04:00
Waylan Limberg
5223e274c1 Fix mkdocs theme TOC.
The sidebar was under the left margin of the main content and not 
clickable. This moves the sidebar to the top so it is accessable. Not 
sure when this got broken. Maybe #1387 or #1389 or #1395.
2018-07-10 11:42:30 -04:00
Waylan Limberg
5e59af5ca3 Remove some unused code. (#1538)
These were some orphaned remnants from the pages refactor.
2018-07-06 16:32:11 -04:00
Waylan Limberg
2f34aec1eb Up version to 1.0.dev
And update release notes to include 0.17.5.
2018-07-06 11:47:11 -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
Waylan Limberg
de576b03bd Close search modal when result is selected.
Fixes #1527.
2018-07-04 17:59:54 -04:00
Waylan Limberg
a1b26ebabe Update documenation. 2018-07-03 15:26:28 -04:00
Waylan Limberg
decaf6141c Add a url filter to templates.
Currently all local URLs must be prepended with base_url while external 
links must not. However, we can have both types of links in the same 
collection. As prepreprocessing of extra_css and extra_javascript 
settings is deprecated, we need a way to indicate the URL should be 
prepended, but only if it needs to be. The same applies to external 
links included in the site navigation. 

Therefore, a new temaplte filter is provided which any URL can be passed 
to. If the URL is absolute, it is returned unaltered. If it is relative 
and the template context includes a `page` object, then a URL is 
returned reltive to the page object. Otherwise, the URL is returned with 
base_url prepended. This also results in cleaner output as paths are 
normailized (redundant . are removed). Of course, the base_url tempalte 
variable remains (it is not being deprecated -- in fact the new filter 
relies on its existance) and template authors may continue to use it if 
they desire.
2018-07-03 15:26:28 -04:00
Waylan Limberg
6f3257cdd7 Exclude code block style from Markdownlint
The Python-Markdown parser includes support for fenced code blocks, but only at the root level of the document. Therefore, a code block nested in a list item must be an indented block. At the same time, MkDocs' code highlighting relies on the language identifier in fenced code blocks to avoid bad guesses. Given the above, we want to allow mixing both styles of code blocks and the way to allow that is to disable Markdown Lint [rule MD046](https://github.com/markdownlint/markdownlint/blob/master/docs/RULES.md#md046---code-block-style).

This new rule was introduced in Markdownlint version [0.5.0](https://github.com/markdownlint/markdownlint/blob/master/CHANGELOG.md#v050) and is currently causing the [tests to fail](https://travis-ci.org/mkdocs/mkdocs/jobs/399711017). This was first discovered in #1526.
2018-07-03 15:25:24 -04:00
Dmitry Shachnev
3de09c9316 Fix two typos in tempdir() docstring 2018-06-30 18:00:56 -04:00
Taras Sotnikov
d161bcd1cf Fix search result urls (#1523) 2018-06-29 20:46:09 -04:00
Waylan Limberg
0a2870749e Use Unicode for server temp dir. (#1517)
The serve command overrights the the site_dir and can cause a crash when
clean_directory tries to remove files with Unicode chars in their
filenames if the paths are byte strings. As os.path.join and friends
will return a byte string (in PY2) if any part is passed in is a byte
string, we must ensure all parts are Unicode strings. By passing a
Unicode string to prefix, tempfile.mkdtemp returns a Unicode string
rather than the default byte string in PY2.  And by passing the tempdir 
path to load_config, it gets validated. Fixes #1516.
2018-06-29 19:51:39 -04:00
Waylan Limberg
fb5abb05a7 Document the builtin themes' lack of support for multi-level nav. 2018-06-29 16:07:03 -04:00
Waylan Limberg
fb9d9e36fb Add a level attribute to AnchorLinks.
This relimplements #1272 on the current code in master. Thanks to 
@funkyfuture for the original work on this.

Also removes some unused code after #1504.

Closes #1272.
2018-06-29 14:40:22 -04:00
Waylan Limberg
78ee87cc2e Document using custom domains with GitHub Pages.
Fixes #1496.
2018-06-29 11:14:57 -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
Dmitry Shachnev
3f0e4464a7 Make the tests pass when git is not installed 2018-05-23 10:32:07 -04:00
Dmitry Shachnev
7dbcf9a22a Make test_doc_dir_in_site_dir work with custom build path
The previous version worked only when ../mkdocs was pointing back
to the current directory.

Fixes #1490.
2018-05-23 08:47:53 -04:00
Phil Elson
34a579ec57 Ensure name is provided in warning about deprecation. 2018-05-23 08:39:54 -04:00
Waylan Limberg
7e06ca68d1 Add multi-level nesting support to sitemap.xml
Fixes #1481.
2018-05-09 11:55:58 -04:00
Waylan Limberg
e5c2459fdf Warn users deploying with older version. (#1467)
Fixes #640.
2018-04-12 16:08:33 -04:00
Waylan Limberg
ee37665418 Ensure deploy commit message points at correct sha.
If/when deploying to usr/org pages, the deploy script is run from the
Pages repo, not the project repo. Therefore, we need ot get the current
sha from the project repo.
2018-04-11 09:53:32 -04:00