ovasquez / mkdocs-merge

Merge the source of multiple MkDocs sites into a single one
https://ovasquez.github.io/mkdocs-merge/
MIT License
22 stars 6 forks source link

Relative links to other markdown pages are not updated after merge #7

Open mihaipopescu opened 6 years ago

mihaipopescu commented 6 years ago

Say you have a mkdocs site with a setup.md that links to other windows.md, macosx.md and linux.md files like this:

setup.md

Here you can find the setup instructions for:
- [Windows](windows.md)
- [MacOSx](macosx.md)
- [Linux](linux.md)

When you merge that to any other master site, the references will point to a non-existing location.

The workaround is to have the links that point to the html's instead:

Here you can find the setup instructions for:
- [Windows](windows/index.html)
- [MacOSx](macosx/index.html)
- [Linux](linux/index.html)

... but that will break the static markdown files making them aware that they will be compiled to html at one point.

Would be nice if mkdocs-merge would do this automatically (and be aware of some other relative links to other directory structure).

Also, the problematic is extended for paragraph bookmarks (index.html#topic1).

How can we solve that in a more consistent way to make all files agnostic of where they are being used? I think this is an open question for later.

ovasquez commented 5 years ago

Sorry for the incredibly late reply.

Given that mkdocs-merge works independently of MkDocs (not as a plugin), I’m not sure it can be done 100% agnostic of where the files will be used because the directory nesting will change.

Having a CLI option to enable link overwrite seems like a good middle ground. I’ll try to come up with several directory scenarios to provide good coverage for this.