foam icon indicating copy to clipboard operation
foam copied to clipboard

markdown links should use readme.md as index file of directory

Open milahu opened this issue 2 years ago • 6 comments

Describe the bug

foam navigates to somedir/.md instead of somedir/readme.md

Small Reproducible Example

No response

Steps to Reproduce the Bug or Issue

lets say i have this markdown file

# asdf

[somedir/](somedir/)

then Control-Click on [somedir/](somedir/) navigates to somedir/.md

Expected behavior

foam should use somedir/readme.md as the index file of the somedir/ folder

... or show a directory listing, if there is no index file

my goal is a "buildless" wiki on the github blob api so readme.md is the default index file, and i can use only markdown links

Screenshots or Videos

No response

Operating System Version

x

Visual Studio Code Version

x

Additional context

No response

milahu avatar Jan 02 '23 11:01 milahu

This is interesting, there was a conversation about this on Discord as well: https://discord.com/channels/729975036148056075/729975036664086560/1049379410228301935

A few notes:

  • I am wondering whether explicitly linking to a directory by appending the / is good or not, still making up my mind about that
  • readme.md kinda makes sense in the context of documentation, some might say index.md would be also good/better?
  • what happens when no such file is found? from the Discord conversation, the suggestion was to show an "explorer-like" list of the files in the directory

Happy to hear more suggestions, edge cases, and considerations

riccardoferretti avatar Jan 02 '23 17:01 riccardoferretti

How about prioritizing

index.md > README.md > <name of the directory>.md > show a explorer view

  • index.html is the web standard
  • README.md catches github, gitlab and other DevOps defaults
  • If you're using dirs to sort by chapters or similar then having a file with the name of the dir makes sense
  • If there's nothing of that kind give up and let the user decide

stefanfritsch avatar Jan 13 '23 23:01 stefanfritsch

How about prioritizing

index.md > README.md > .md > show a explorer view

👍 My understanding is that this chain of defaults (at least index.md and readme.md) is the same as how github.com chooses docs to render in a repo directory, which feels good and consistent!

j6k4m8 avatar Aug 15 '23 11:08 j6k4m8

That's interesting, do you have a reference for that chain of defaults?

riccardoferretti avatar Aug 17 '23 08:08 riccardoferretti

Unfortunately not — I've looked and it looks like it doesn't exist anywhere in the docs... I can try to make a demo repo at some point to test

j6k4m8 avatar Aug 17 '23 15:08 j6k4m8