onixpro / mkdocs-drawio-file

Embeding files of Diagrams.net (Draw.io) into MkDocs
20 stars 5 forks source link

Relative links to .drawio files and 'use_directory_urls: true' do not behave well #12

Open noltedennis opened 1 year ago

noltedennis commented 1 year ago

Assume a directory structure for the mkdocs project is as follows: / ├── docs │ ├── media │ │ └── test.drawio │ ├── test │ │ └── test3 │ │ └── index.md └── mkdocs.yml

Notably,

  1. there exists a separate media directory and
  2. pages are potentially nested and are named index.md. This is important, because with use_directory_urls: true (mkdocs default), their url will be stripped off the index.html in the rendering process.

Then, in order to get a successful build, one must reference the drawio file in index.md with an extra ../ (correct would be ../../media.test.drawio), i.e. it must instead be referenced as: ![](../../../media/test.drawio)

In addition, mkdocs will issue a warning in the build pipeline for each .drawio file linked this way, because mkdocs itself cannot locate the file. This largely stems from the following LOC: https://github.com/onixpro/mkdocs-drawio-file/blob/c547793f1338f2120ac48722b2eeed5bb3181d91/mkdocs_drawio_file/plugin.py#L61-L62

noltedennis commented 1 year ago

I'll hopefully be able to provide a pull request for this in the near future.

noltedennis commented 1 year ago

I'll hopefully be able to provide a pull request for this in the near future.

Pull request provided.