Skip to content

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

@sdeiley

Description

@sdeiley

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

  • there is a clickable message saying "Wikilink definitions (out of date)" which, when clicked, deletes the markdown links.
  • Foam: Run Janitor (experimental) also does the exact thing (add or remove markdown links) to all files in the directory.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions