Skip to content

Commit

Permalink
Mkdocs: default to "docs" for docs_dir
Browse files Browse the repository at this point in the history
This value has been the default since the start of the project
https://github.com/mkdocs/mkdocs/blob/0.13.0/mkdocs/config/defaults.py#L44

We should respect that default value,
(we should actually don't edit it at all #2483).

So, instead of trying to guess the docs dir always,
only try to guess it if the user doesn't have mkdocs.yaml file.

This should avoid any backwards compatibility and avoid weird bugs to
new users.

Closes #7539
  • Loading branch information
stsewd committed Dec 17, 2020
1 parent 1bf51bd commit 709545d
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions readthedocs/doc_builder/backends/mkdocs.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ def load_yaml_config(self):
)
return {
'site_name': self.version.project.name,
'docs_dir': self.docs_dir(),
}
except yaml.YAMLError as exc:
note = ''
Expand All @@ -139,14 +140,12 @@ def append_conf(self):
user_config = self.load_yaml_config()

# Handle custom docs dirs
user_docs_dir = user_config.get('docs_dir')
if not isinstance(user_docs_dir, (type(None), str)):
docs_dir = user_config.get('docs_dir', 'docs')
if not isinstance(docs_dir, (type(None), str)):
raise MkDocsYAMLParseError(
MkDocsYAMLParseError.INVALID_DOCS_DIR_CONFIG,
)

docs_dir = self.docs_dir(docs_dir=user_docs_dir)

self.create_index(extension='md')
user_config['docs_dir'] = docs_dir

Expand Down

0 comments on commit 709545d

Please sign in to comment.