GithubHelp home page GithubHelp logo

Comments (8)

oprypin avatar oprypin commented on June 16, 2024

It is expected that a link ending with / or .html will always be wrong (unless you've actually put a .html document into docs). Links need to be always to .md files that exist in docs dir.

See previously https://github.com/mkdocs/mkdocs/releases/tag/1.5.0#expanded-validation-of-links "Validated links in Markdown" - and the same applies to the newly enabled absolute links

from mkdocs.

Blacksmoke16 avatar Blacksmoke16 commented on June 16, 2024

Okay, but it seems no matter what I use, it produces the same warning. I can see the file in site/Framework/Events/Request/index.html. So that should map to /Framework/Events/Request/index.md; but seems only URL that actually works is /Framework/Events/Request with or without a trailing /.

NOTE: I changed something in the sub-project to make the url have a capitalized Framework in the URL, but that didn't change anything.

EDIT: /Framework/Events/Request/index.html actually does work, but still produces the error:

WARNING -  Doc file 'architecture.md' contains a link '/Framework/Events/Request/index.html', but the target is not found
           among documentation files.

from mkdocs.

Blacksmoke16 avatar Blacksmoke16 commented on June 16, 2024

@oprypin Seems this is a https://squidfunk.github.io/mkdocs-material/plugins/projects/ specific thing. Only seems to happen when pointing to a file a part of a sub-project. Imma close and open an issue over there.

from mkdocs.

oprypin avatar oprypin commented on June 16, 2024

Just from that plugin's concept, I guess the whole point is to split up sites into sub-sites, and validation is not really possible to implement fully correctly without running some part of the build process of MkDocs (files get added dynamically) for the other sites. So the correct mode for that plugin may be absolute_links: ignore ๐Ÿ˜ฌ

from mkdocs.

OmarTawfik avatar OmarTawfik commented on June 16, 2024

@oprypin I'm seeing the same issue, but for a different use case (without plugins):

Doc file 'user-guide/index.md' contains an unrecognized relative link './foo/', it was left as is. Did you mean './foo/index.md'?

We have use_directory_urls: true, and we want to keep using ./foo/, instead of ./foo/index.md. The links are actually compiled correctly, and the resulting site works! so I'm not sure if the warning is useful here.

Since mkdocs already works correctly with this input, I do believe it is a false positive indeed. This validation is very useful otherwise.

from mkdocs.

pawamoy avatar pawamoy commented on June 16, 2024

I believe the rationale is that it's easier for MkDocs to detect and validate links when they use /index.md. That also makes validation more robust against configuration changes, like switching from directory URLs to non-directory ones.

from mkdocs.

OmarTawfik avatar OmarTawfik commented on June 16, 2024

like switching from directory URLs to non-directory ones.

In that case, the warning should be conditional on that flag use_directory_urls IMO. This is a valid user scenario, and is already supported and working correctly in the compiled site. It is only validation that is incorrectly flagging the link as broken.

from mkdocs.

pawamoy avatar pawamoy commented on June 16, 2024

I think I remember there were technical reasons why it's better to use /index.md but I can't seem to find them. I think it's good that MkDocs pushes you to use the best approach for writing links, while allowing you to discard (debug) or disarm (info) the warnings with configuration options.

EDIT: ah, one of the reason might be that using /index.md plays nicer with other tools like editors which are then able to see you're linking to an existing file.

from mkdocs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.