foam icon indicating copy to clipboard operation
foam copied to clipboard

Lost escape character (\) in table after rename a file

Open hukacode opened this issue 2 years ago • 1 comments

Describe the bug

  • Give an simple table and wikilink with an alias like this, I use \ to escape | because this wikilink is in a table.
|                |
| -------------- |
| [[test\|Test]] |
  • After I rename the test.md file to test2.md, the table will be updated like this (missing the \)
|                |
| -------------- |
| [[test2|Test]] |

Small Reproducible Example

No response

Steps to Reproduce the Bug or Issue

  1. Create a new note with this content:
|                |
| -------------- |
| [[test\|Test]] |
  1. Create a test.md file.
  2. Rename the test.md to test2.md.
  3. Verify the table in the first note.

Expected behavior

As a user, I expect that after I rename a file, the wikilink in a table does not remove escape character.

Screenshots or Videos

No response

Operating System Version

Linux

Visual Studio Code Version

1.66.1

Additional context

Foam version v0.18.3

hukacode avatar Apr 23 '22 15:04 hukacode

Yup, I know what causes this issue, and I have an idea of how we could go about fixing it. Will take a look when I have some time, but if you or someone wants to address it, look at the MarkdownlLink.createUpdateLinkEdit function. My guess is that we'd need to check what separator was used in the original link, and reuse that, but this needs to be looked at properly and tested.

riccardoferretti avatar Apr 28 '22 15:04 riccardoferretti