serokell/xrefcheck

Warn user when see `\` in local link

Sorokin-Anton opened this issue · 2 comments

Clarification and motivation

Currently a\b.md is threated as file in . that has backslash in name, and that is correct (e.g. GitHub understand it this way). Windows users can write this meaning file b.md in dir a. I think we should write them something like '\' is not threated as path separator here, maybe you mean "a/b.md"? instead of just reporting a\b.md as unexisting file.
Inverse slashes in filenames are unsupported in Windows, but supported in Linux, so we shouldn't forbid them at all.
I suggest to write message about path separators only when there really is a file with such path (a/b.md in my example)

Acceptance criteria

  • If I write [foo](a\b.md) and file a/b.md exists, xrefcheck prints useful message
  • I still can use links to files with name like a\b.md

I agree with the idea of the dedicated error message, but don't fully agree with throwing it only when the filepath is itself correct.

It makes a point, but what I worry about is: if I have a file both with \ and with a typo in filename, fixing that would require two check-edit iterations which some users will find unpleasant, and there is no actual need for this.

We could, for instance, report two different errors for such links.

But that's arguable indeed.

@Martoon-00 Ok but in this case there should be a way to disable this error for users who actually use \ as a part of file name