Skip to content

Commit 660ce25

Browse files
committed
Support 'mkdocs.yml' as a fallback after 'properdocs.yml' is not found
Add a corresponding warning at INFO level
1 parent c91e22b commit 660ce25

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

properdocs/config/base.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ def _open_config_file(config_file: str | IO | None) -> Iterator[IO]:
286286
"""
287287
# Default to the standard config filename.
288288
if config_file is None:
289-
paths_to_try = ['properdocs.yml', 'properdocs.yaml']
289+
paths_to_try = ['properdocs.yml', 'properdocs.yaml', 'mkdocs.yml', 'mkdocs.yaml']
290290
# If it is a string, we can assume it is a path and attempt to open it.
291291
elif isinstance(config_file, str):
292292
paths_to_try = [config_file]
@@ -300,10 +300,15 @@ def _open_config_file(config_file: str | IO | None) -> Iterator[IO]:
300300
if paths_to_try:
301301
# config_file is not a file descriptor, so open it as a path.
302302
for path in paths_to_try:
303-
path = os.path.abspath(path)
304-
log.debug(f"Loading configuration file: {path}")
303+
abspath = os.path.abspath(path)
304+
log.debug(f"Loading configuration file: {abspath}")
305305
try:
306-
result_config_file = open(path, 'rb')
306+
result_config_file = open(abspath, 'rb')
307+
if len(paths_to_try) > 1 and path in ('mkdocs.yml', 'mkdocs.yaml'):
308+
log.info(
309+
f"The configuration file '{path}' should be renamed to 'properdocs.yml', OR it should be passed explicitly on the command line: `-f {path}`.\n"
310+
"Support for using this legacy file name as a fallback will eventually be removed from ProperDocs."
311+
)
307312
break
308313
except FileNotFoundError:
309314
continue

0 commit comments

Comments
 (0)