Skip to content

Further improve wikilink handling #1977

@thomas-zahner

Description

@thomas-zahner

I was trying out this feature and I wrote these notes about things that I thought were unexpected:

  • when a link is not found, the error message is long because it repeats the message twice. it also repeats the base directory twice and makes the invalid path /home/x/progs/lychee/fixtures/home/x/progs/lychee/fixtures/Doesn't exist.md - i don't know whether this is intentional.

       [ERROR] file:///home/x/progs/lychee/fixtures/Doesn't%20exist.md |
       Wikilink file:///home/x/progs/lychee/fixtures/Doesn't%20exist.md not found at /home/x/progs/lychee/fixtures/home/x/progs/lychee/fixtures/Doesn't exist.md:
       WikiLink file:///home/x/progs/lychee/fixtures/Doesn't%20exist.md could not be found at /home/x/progs/lychee/fixtures/home/x/progs/lychee/fixtures/Doesn't exist.md
    
  • to specify the indexing folder, i think --root-dir would've made more sense, or it could even be based off the inputs provided through command line. but it does work with --base-url so it's nbd.

  • wikilinks, if enabled, are tried on all file:// links, including absolute links. for instance, a link like [a](file:///tmp/Usage.md) could succeed when /tmp/Usage.md doesn't exist and a Usage.md exists inside the base folder. maybe it should be limited to relative links which only have filenames.

  • the wikilink feature does its own directory walk. this is different from other directory walks in lychee and won't respect options like gitignore or hidden files. actively ignoring symlinks is also weird.

  • wikilinks always ignore fragments? i can't see anything in the obsidian help page which says they should be disregarded. the unit tests also seem to say that they should be resolved (unless "resolve" is meant as "ignore"). i note that if fragments were to be processed, the current markdown extractor would have to be changed. atm, it makes anchors using #kebab-case which is different to what obsidian uses in wikilinks.

Aside from the first point, I think these points are kinda hard to fix or don't necessarily need fixing. Just things to think about.

Originally posted by @katrinafyi in #1799 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions