-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update information on mkdocs build process #4508
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution!
First, I'm not an expert on MkDocs. That said, I tried to find where we do this in our code and I didn't find it. I seems that we only look for mkdocs.yml
at the root of the project:
Reading that code, it seems that we look into the project's root directory and if we don't find it we return None
. Then, we create a mkdocs.yml
with just one entry site_name
and add the docs_dir
(one of docs
, doc
, Doc
, book
if any of them exists in that order) at
So, looking at the code it seems that we require a mkdocs.yml
in the root.
I'm a little confused, tough.
The recomended layout for a mkdocs project is
https://www.mkdocs.org/user-guide/writing-your-docs/#file-layout So having
would be a little weird... Maybe having
makes more sense. So +1 to edit the docs to reflect that.
What @humitos mention is maybe what the docs wanted to say. |
Well, looks like the docs already mention that we only search in the root of the project |
That makes sense to me, and I just confirmed that not having I think the docs don't mention that |
I'm not sure why the Travis build failed, I only modified the wording within |
Travis failed because of time out, I just restarted the jobs |
docs/builds.rst
Outdated
@@ -46,7 +46,7 @@ we will first look for a ``mkdocs.yml`` file in the root of your repository. | |||
If we don't find one, | |||
we will generate one for you. | |||
|
|||
Then MkDocs will build any files with a ``.md`` extension. | |||
Then MkDocs will build any files with a ``.md`` extension within a single directory called ``docs``, ``doc``, ``Doc``, or ``book`` (this is the order in which directories are searched). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be a little more clear since rtd only search in this directories if it doesn't find a mkdocs.yml file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. I can add a bit more detail to make the entire process more clear.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left a question.
I think it's the only needed to merge this PR.
docs/builds.rst
Outdated
Then MkDocs will build any files with a ``.md`` extension within the directory specifed as ``docs_dir`` in the ``mkdocs.yml``. | ||
|
||
If no ``mkdocs.yml`` was found in the root of your repository and we generated one for you, | ||
MkDocs will attempt to set ``docs_dir`` by sequentially searching for a ``docs``, ``doc``, ``Doc``, or ``book`` directory. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think here it should say Read the Docs will attempt
instead of MkDocs will attempt
since this is something that RTD code does, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree-- that sounds better. I'll add that change!
Thanks for all your comments! Is there anything else I should change before this PR gets merged in? |
From my side, I don't think so. We only need to someone from the core team the press the |
No worries at all, just happy to contribute! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks!
This PR should resolve #4507. As per #4231, builds fail with mkdocs when markdown files are not in a
doc
ordocs
directory. Themkdocs.yml
could either be in the root or in thedocs
directory, as per https://www.mkdocs.org/about/release-notes/#stricter-directory-validation and my own testing within my own project.I was able to solve this issue by moving my
mkdocs.yml
and relevant markdown files to adocs
directory. I also tested this with adoc
directory, see this closed PR in my project. I think it makes sense to have the docs reflect this so future users know to have their files in the correct directory.Of course, this doesn't solve the issue of builds failing when files are at the root, but users should be aware of the current caveat.
This is my first PR, so I am definitely open to feedback, comments, and questions :)