Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wikilinks activated: special characters make the links to not work #1298

Closed
JuanLucha opened this issue Oct 19, 2023 · 6 comments
Closed

Wikilinks activated: special characters make the links to not work #1298

JuanLucha opened this issue Oct 19, 2023 · 6 comments
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed

Comments

@JuanLucha
Copy link

JuanLucha commented Oct 19, 2023

Describe the bug

Creating a link with special characters when the wikilinks are activated, makes the link to stop working at saving the file (which is the time where the wikilinks are created).

Small Reproducible Example

No response

Steps to Reproduce the Bug or Issue

Example 1:

  1. I create a link: [[Select a choice: Multiple ones]]

  2. I press my keys to enter/create the note.

  3. I can see the Select a choice: Multiple ones.md file is created.

  4. I save the file containing the link.

  5. It does some magic, so it adds this at the end of the file: [Select a choice: Multiple ones]: <Select a choice: Multiple ones> "Select a choice: Multiple ones".

  6. Now, the link has the "this link is not linked to any note" color.

  7. If I click on the link now, it creates a file called Multiple ones.md

Example 2:

  1. I create a link [[Música]]
  2. I enter the link, and it creates the file Música.md
  3. I save the original file containing the link.
  4. Magic happens and this is appended: [Música]: Música "Música"
  5. The link is in the "this link points to a created note" state, but when I click on it, it goes to the bottom of the same file, where this [Música]: Música "Música" thingy is...

Note: it could be related to : in the title changed to _ in the file name. Example: P2 - Alignment_ Excerpts in emails having links.md instead of P2 - Alignment: Excerpts in emails having links.md

Expected behavior

The link should take you to the right note.
The note filename should be the same as the link (for example, if the link has : don't replace it with _).
If the wikilink is defined in the file, clicking the link should still take you to the note, not to the definition at the bottom of the file.

Screenshots or Videos

No response

Operating System Version

macOs: Sonoma 14.0

Visual Studio Code Version

Version: 1.83.1 (Universal)

Additional context

I write in Spanish, so my file names commonly use ñ and tildes (á).

@riccardoferretti
Copy link
Collaborator

When wikilink definitions are disabled the user flow works fine. The issue is with the wikilink definition generation.

Specifically the above [[Select a choice: Multiple ones]] wikilink will generate the following definition:

[Select a choice: Multiple ones]: <Select a choice: Multiple ones.md> "Select a choice: Multiple ones"

Which is incorrect. After some testing it looks like the correct definition should look like this:

[Select a choice\: Multiple ones]: <Select a choice: Multiple ones.md> "Select a choice: Multiple ones"

Needs some investigation in terms of which characters need to be escaped

@JuanLucha
Copy link
Author

Thanks for the investigation @riccardoferretti !

@JuanLucha
Copy link
Author

I just fixed the layout of the issue (the wikilink line was messing the rest of the text.

@riccardoferretti
Copy link
Collaborator

Just wanted to also point out that the workaround, unless you need wikilink definitions (if you are not sure, you probably don't), you can just disable them and the link will work.
Wikilink definitions are useful to integrate the Foam project with other tools (e.g. github pages). If you just work within VS Code you can safely turn them off (I personally do)

@JuanLucha
Copy link
Author

Indeed, I disabled wikilinks, and it works like a charm. I don't really need it outside of vscode so all good from my side 👍

@cricrio
Copy link

cricrio commented Mar 15, 2024

I'm still reproducing this issue with the characters ? and '.

Example: [[D'accord]] [[Doc ?]]

The links in the markdown preview are redirecting to D and Doc and these files don't exist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants