Skip to content
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

Disable navigation warning #1888

Closed
adibrastegarnia opened this issue Oct 19, 2019 · 14 comments · Fixed by #3224
Closed

Disable navigation warning #1888

adibrastegarnia opened this issue Oct 19, 2019 · 14 comments · Fixed by #3224

Comments

@adibrastegarnia
Copy link

Hi,

Is it possible to disable navigation warning? I mean this message:
The following pages exist in the docs directory, but are not included in the "nav" configuration:

@waylan
Copy link
Member

waylan commented Oct 20, 2019

That is an "info" message, not a warning. The only benefit to disabling it from being displayed it that it is not displayed. In other words, it does not cause "strict" mode to fail, for example.

Interestingly, some have requested the opposite (see #1755).

I guess I'll consider this a request for a "quiet" option. To be clear, if we adding this option, it would disable the display of all "info" messages, not just the list of pages not included in the nav.

@isedwards
Copy link

It would be useful to be able to mark a page as intentionally not included in the nav. When new people contribute to the docs they don't know which pages are intentionally excluded and which may have been missed by accident.

@NicolasMassart
Copy link

I'd like that as for me, the root index.md at least should not raise a warning as I don't need it in the nav...

@majkinetor
Copy link

majkinetor commented Sep 24, 2022

I have similar warning I want to hide.

I have bunch of files repoted as warning since one plugin keeps internal stuff in the docs structure. Its houndreeds of warnings like this:

image

I know about those, and it must be that way, so all this warning does is spam other output. Ideally I would be able to say that there should be no warning for path /db/*.

@oprypin
Copy link
Contributor

oprypin commented Sep 24, 2022

I have bunch of files repoted as warning since one plugin keeps internal stuff in the docs structure

That's just the plugins fault. If you want help fixing it, you can point me to the issue.

@oprypin
Copy link
Contributor

oprypin commented Sep 24, 2022

Also that's not even what the current issue is about.

@majkinetor
Copy link

@oprypin , its effectivelly the same problem - warning spam. Its IMO irrevelant what is the precise reason.

That's just the plugins fault. If you want help fixing it, you can point me to the issue.

Its not plugins fault, its the way I use it, and it works great. In short, some pages describing the database automatically look for sql definition and txt examples in a same folder where md page is located and adds links to those files to the md page (also adding content to the md page). Except for huge amount of warnings there is absolutelly no reason to move those sql and txt files to other place.

The warning is also incorrect and possibly even a bug - files are found among documentation.

But I digress, the issue is warning spam, when you know the warnings are irrelevant. Majority of systems allow for disabling specific or all of the warnings.

@oprypin
Copy link
Contributor

oprypin commented Sep 24, 2022

I am not dismissing that these warnings should be able to be silenced. I'll handle that in the upcoming months.

But please don't also dismiss what I am saying.

The warning is also incorrect and possibly even a bug - files are found among documentation.

Yes, it's a bug in the plugin. It will be there regardless if you're able to silence all warnings.

@majkinetor
Copy link

I am not dismissing that these warnings should be able to be silenced. I'll handle that in the upcoming months.

That is great, thanks.

Yes, it's a bug in the plugin. It will be there regardless if you're able to silence all warnings.

I don't think that is the case. Plugin I use is mkdocs-macros that lets me, among other things, use python to create functions which I can use on md pages via jinja templates. This is the macro I wrote which creates this problem.

I have 3 files X.md, X.sql, X.txt, each in the same folder inside the docs folder. The md page describes a database table and X.sql contas DDL while X.txt contains data sample.

In main.py that macros plugin lets me use:

    @env.macro
    def inc( page, ext="sql", title="SQL" ):
        fileFullName = page.title + '.' + ext
        fileFullPath = page.file.abs_src_path.replace('.md',  f'.{ext}')

        try:
            with open(fileFullPath) as f:
                lines = f.read()
        except FileNotFoundError:
            return ''

        return f"""
## {title}
Download: [{fileFullName}](../{fileFullName})             <============ generates warnings
```{ext}
{lines}
```   `
"""

In X.md

#  X

...

{{ inc( page, 'sql', 'SQL') }}
{{ inc( page, 'txt', 'Data Example') }}

So this is mkdocs that warns me about this, not the plugin, so handling warning should help as far as I can see.

@redtide
Copy link

redtide commented Apr 16, 2023

My only problem with this is that some files are not linked from nav, like the contacts page is linked in the footer and posts in a blog are handled by the plugin, I don't want to have a flood of lots files not in nav because they simply shouldn't be there.
So, if I don't miss something, would be nice to have a "not_in_nav" setting that can be configured with both files and directories (glob), like "the files in this list and these directories are known to be handled somewhere else".

@oprypin oprypin added this to the 1.5.0 milestone May 17, 2023
@oprypin
Copy link
Contributor

oprypin commented May 17, 2023

I am now indeed thinking to add a way to configure patterns of files that are OK to not be in nav.
Along with

not_in_nav is actually a pretty good name for the config. It just looks strange to the eye somehow, with 3 very short words :D

@majkinetor
Copy link

majkinetor commented Jun 11, 2023

@oprypin , while this probably helps with the warning, it is because files are now not built at all? Or am I missing something?

In my case, I do build files, they are just not in nav, and since I have lots of them not in nav, I have lots of warnings. So the issue is warning for the files to be built, not the exlusions of such files.

@oprypin
Copy link
Contributor

oprypin commented Jun 11, 2023

See not_in_nav https://github.com/mkdocs/mkdocs/pull/3224/files

@majkinetor
Copy link

majkinetor commented Jun 11, 2023

Thats it.

Cheers @oprypin for your work. 🍾

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants