artempyanykh/marksman

[Feature Request] Support escape slash for the renaming pipe in wikilinks

pprotas opened this issue · 1 comments

Hey there, this might be a super specific situation but I think it would be great to support [[my-note\|My Note]] syntax, which contains the escape character \ before the rename pipe. The WikiLink works exactly the same, and in fact the slash simply gets ignored.

Why is this useful? Well many people use tools that auto-format tables, which use the same pipe symbol | as the one you use for renaming. Imagine I whip up this unformatted table:

| Number | Example |
|-|-|
|1| [[my-link\|My link]]|
|2| [[my-link|My Link]] |

And I use markdown auto-formatter that makes my tables look pretty (like deno-fmt), this is the result:

| Number | Example              |
| ------ | -------------------- |
| 1      | [[my-link\|My link]] |
| 2      | [[my-link            |

As you can see, number 1 is formatted perfectly because of the escape backslash, but number 2 has a bunch of text missing because my formatter thinks that this pipe character is the end of that table row, even though it's not.

Now, the problem is not with the formatter, because deno-fmt handles the backslash perfectly fine. The problem is with Marksman, because for number 1 I get this error message:

Link to non-existent document 'my-link\|My link'

Because of this backslash, Marksman thinks that 'my-link\|My link' is the document name, but it's not. It should only be looking at the my-link part.

BTW, supporting the backslash is not a weird feature. Obsidian supports the backslash as an escape character:

image

TLDR: Please support backslashes for the pipe operator in Wikilinks <3

Hey @pprotas! Thanks for reporting this! Yeah, I think it's reasonable to handle backslash-escaped pipe inside wiki-links.