-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Add ability to warn about pages existing in the docs directory but not included in the "nav" configuration #1755
Comments
So, this used to be a warning, but was changed to an info message because we got complaints. I initially made it a warning for this very use case. Unfortunately, for users who want to have pages not included in the nav, this would mean they can't use We could create a new setting, but we generally try to reduce the number of settings, not add more. From one viewpoint, the setting already exists in For reference, #1604 seems related in part. As a workaround, is there any reason why you can't let MkDocs auto-generate the nav? That would ensure all pages are already included in the nav. There are other ways to define page titles. Or do you need to define a custom sort order (which can only be done in the |
Could you do something like an even stronger strict mode if you have multiple strict flags? Much like how you can sometimes raise verbosity in some applications with multiple verbose flags |
I considered that briefly, although I haven't given it much thought. And yes click supports it, IIRC. Perhaps something like, And how do we handle the matching config setting? Using |
I personally don't think it needs to be tied to all INFO or anything like that as some INFO is just INFO, but yeah, it could elevate some INFO to WARN level. For this reason, I don't think If you wanted some distinction, than you could tag some info with DEBUG instead of INFO if later it could be elevated to warn. I'm not sure how many levels of |
It occurs to me that you are assuming that we do the following at each location where a warning is raised: if config['strict']:
raise error(msg)
else:
log.warning(msg) But that is not what we do. We simply raise a warning. We then use a However, I suppose we could do something like the following at select locations in the code: if config['strict'] >= 2:
log.warning(msg)
else:
log.info(msg) I just think that would be weird. Why are only some |
If inconsistency is a problem, you would have to have more granularity in how you log messages or group things in a way that makes more sense. I agree that raising all Of course this is only a suggestion, and if it doesn't make sense due to how this project is architected, then that is okay too. I was mainly just trying to suggest a way to avoid a new config variable by extended the existing functionality in a way that might make sense for the project, but if it doesn't, then maybe some other option is more suitable. |
Well, we are just using the logging lib's logging levels, which are just integers. The lib fully supports defining and using your own levels. We could define a level between |
|
@waylan, @facelessuser, thanks for your quick response and such fruitful discussion!
The problem is we have Markdown files pretty much unordered in a directory, i.e. we don't prefix them with numbers or similar, and use the Regarding the proposed solutions to tackle this use case, I have a few thoughts. Are there other If yes, then perhaps the introduction of another logging level in between Then Note that changing the |
I agree. |
Generally, introducing an esoteric logging level seems... off. That said... consider 'notice' to be between 'info' and 'warning'? |
A log level between "warning" and "info" is "notice". See RFC 3164 - The BSD syslog Protocol. @trel was a bit faster. |
Excellent! |
What is the approach for a plugin that generates a Markdown file, which is also referenced in the "nav" section of
even though the events are ostensibly following correct means of adding the associated |
@Cetra, please start a new discussion and ask your question there. While related to this issue, discussing your question will add a lot of noise to the discussion of the issue. Also, please provide some information about how you are generating Markdown files. Which events are you using in your plugin? |
Any update on this? Similarly, would love this feature in place for CI purposes. |
I was also using |
The redirect plugin creates pages that are not included in the nav. Setting the level back to warning would prevent every user of the redirect plugin to use |
@pawamoy This particular aspect I think is actually not a concern at all. It's only about one-off setups that may exist. I.e. "I just want MkDocs to copy this file, why do I have to put it in nav"
It doesn't actually create pages, only files in the last stage of the build, so there's no warnings associated with it. |
Ah, true, my bad, I had the log because I was using a custom script and not mkdocs-redirects! Sorry! And thanks for the link, will check this out |
I would be quite curious about how to trick mkdocs to not complain about "The following pages exist in the docs directory" for stuff that I need it there but I do not want to include it inside the navigation (they are included from other files). |
I would like to make many of the messages have configurable logging levels among Here's a survey of relevant logging messages and situations. File
Nav
Markdown
|
@oprypin , can this be overrided on page level ? I want to exclude specific pages from warnings, but I don't want to turn off warning in general, as it is useful to me. Nevertheless, for the pages I acknowledged that are correct, I don't want warning anymore. |
@majkinetor Yes that is available! https://github.com/mkdocs/mkdocs/releases/tag/1.5.0 added exactly such a feature |
Use case
A team uses a CI system and would like to ensure documentation quality never regresses.
To this end, the CI job has a step that runs
mkdocs build --strict
which reports a failure if building the documentation results in any warnings or errors.However, it can still happen that someone will write new documentation but forget to include it in the
nav
configuration. And MkDocs will detect this and report it. Here is an example output:Feature request
Would it be possible to configure this INFO message to be a WARNING?
As a bonus, would it be possible to configure which files in the docs directory should be ignored by MkDocs completely?
The text was updated successfully, but these errors were encountered: