foambubble / foam

A personal knowledge management and sharing system for VSCode
https://foambubble.github.io/
Other
15.16k stars 649 forks source link

Wikilink markdown link generation deletes/recreates each time the file is saved #1339

Open sdeiley opened 5 months ago

sdeiley commented 5 months ago

Describe the bug

Succinct Description:

When I save a file, with or without changes, Foam either removes existing markdown links for that notes wikilinks, or it generates them if they aren't there.

Exact Observed Behavior

Consider a simple markdown file with the following:

## Title
[[root.AnotherNote.md]]

Now I save the file. I see

## Title
[[root.AnotherNote.md]]

[//begin]: # "Autogenerated link references for markdown compatibility"
[root.AnotherNote.md] root.AnotherNote "Another Note"
[//end]: # "Autogenerated link references"

However, if I save again, I see (notice additional newlines at bottom):

## Title
[[root.AnotherNote.md]]

Additional Notes

Settings

My only explicit foam setting is:

{
...
  "foam.edit.linkReferenceDefinitions": "withoutExtensions",
}

Small Reproducible Example

No response

Steps to Reproduce the Bug or Issue

  1. Fresh install of foam version 0.25.8 (note: I have other markdown extensions, I am not sure if they are the problem).
  2. Change foam setting "foam.edit.linkReferenceDefinitions": "withoutExtensions"
  3. Create two notes. Wikilink one from the other.
  4. CNTL+SHIFT+P File: Save
  5. Observe changes to file
  6. Repeate Steps 4/5

Expected behavior

I didn't expect the links to be deleted by saving or Foam: Run Janitor. I also don't expect the little description "Wikilinks out of date" to be there.

Screenshots or Videos

Screenshot 2024-02-26 at 1 33 48 PM

Operating System Version

macOS

Visual Studio Code Version

Version: 1.86.1 (Universal) Commit: 31c37ee8f63491495ac49e43b8544550

Additional context

No response

riccardoferretti commented 5 months ago

I cannot reproduce this from the given steps, can you please provide a repo to use as base where the issue can be reproduced?