orbikm / mkdocs-ezlinks-plugin

Plugin for mkdocs which enables easier linking between pages
MIT License
34 stars 17 forks source link

Expecting `[[./a/index]]` to return `<a href="a/"`, get `<a href="a/index"` #53

Open ooker777 opened 8 months ago

ooker777 commented 8 months ago

With this mkdocs.yml:

site_name: test
plugins:
  - ezlinks:
        wikilinks: true

And this folder structure:

docs/ 
├── index.md 
└── a/ 
    └── index.md

After the build we will have:

site/ 
├── index.html
└── a/ 
    └── index.html

If in docs/index.md you have this content:

[[a/index]]
[[a/index.md]]
[[./a/index]]
[[./a/index.md]]

Then in site/index.html the html will be:

| docs/index.md    | site/index.html                                    | Correct? |
| ---------------- | -------------------------------------------------- | -------- |
| [[a/index]]      | <a href="a/" title="a/index">a/index</a>           | ✔        |
| [[a/index.md]]   | <a href="a/" title="a/index.md">a/index.md</a>     | ✔        |
| [[./a/index]]    | <a href="a/index" title="./a/index">./a/index</a>  | ❌       |
| [[./a/index.md]] | <a href="a/" title="./a/index.md">./a/index.md</a> | ✔        |

At the same time Mkdocs will notice this:

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