Relative paths in an folder/index.md file
Describe the bug
In an index.md file in a subfolder, normal links relative to the file do not work as if the index.md is in that subfolder, but rather that the index.md is in the parent dir.
To Reproduce Steps to reproduce the behavior:
- Create an index.md in a subfolder
- Add a relative link in that subfolder
- See the broken link
- Adjust the relative link as if index.md is in the parent folder
- See the working link
See my fork of the emanote template for an example
Expected behavior Relative links should work as if the index.md is where it is.
Comments This is somewhat addressed in the docs:
Instead of foo.md, you can also use foo/index.md (or index.org if using Org Mode ✍️) or foo/index.yaml. Internally, Emanote will treat them as foo.md and foo.yaml respectively.
I would argue that this is a bit confusing though. I'm happy to make a pull request with a more detailed explanation, but how hard would it be to make index.md use the correct relative path? This way editor integration would be better (i.e. path suggestions).
I'm happy to make a pull request with a more detailed explanation,
👍🏾
but how hard would it be to make
index.mduse the correct relative path?
Link resolution is in emanote/src/Emanote/Model/Link/Resolve.hs
But relocateRelUrlUnder is probably relevant for relative links:
https://github.com/srid/emanote/blob/966072803b8bf0456ff94e4e9b6125632d9a0ba1/emanote/src/Emanote/Model/Link/Rel.hs#L101-L107
See also https://github.com/srid/emanote/pull/268