On Monday I looked into the extent of broken links in The Quantum Garden Vault. These are links created in notes which do not have a matching destination. My exploration in Resolving unresolved links was live in the sense of writing my thoughts down as I explored the prlblem. I knew what I meant but also realise my explanations might remain incomprehensible.

The problem can be summed up as a habit of automatically creating outgoing links for names and dates without thinking if they would be of use. Instead of preparing the way for my Future self all I’ve done is create a signal-to-noise problem. It’s impossible looking at a list of over 1,300 missing notes to find those which need my knowledge creating attention.

I thought others might be interested in my approach to tackle this problem and reduce the broken link noise in my system.

Question 1: Keep the status quo or fix the problem?

If I’ve got this far then obviously there is a problem that needs to be fixed. However, keeping the status quo is always an option. I’ve discounted that because the noise is keeping me away from my goals.

Question 2: What can I handle in bulk?

The way to eat an elephant is one bite at a time. 1,300+ bites is a very large meal so are there ways to take bulk actions: manually or automatically.

❌ Open each file with an outgoing link and remove the [[ ]] that create the link. An untenable option for the time it takes.

❌ Open each file with an outgoing link, select the text and use the Text Format plugin to convert wikilink format to plain text. Selecting the whole note is fast, but the conversion also removes valid links. Still requires me to open every file.

❌ Use a plugin to create all missing notes. Removes the broken links by hiding the problem. Each note moves from the broken notes list to the empty files list. It’s not knowledge.

✅ Write code that will identify the location of all broken links and programatically edit the file to remove the offending [[ ]].

This is the only solution I that will work. I’m confident I can have something running an an hour which is much less that editing each file would take. However, without preparation it solves the problem by eliminating the signal-to-noise-ratio completely and a side effect is losing what might be called legitimate outgoing links; those where I’ve linked to knowledge I want to write about.

Preparation

I have to save what needs saving. That mean creating the destination notes for all broken links. There are two ways to do this:

  1. Click on each link to create the file and complete it, or
  2. Click on each link to create it and leave the target as an empty file.

I’m content to work with option 2. It doesn’t create any content — my ultimate goal — but it does clean out the friction that is currently preventing me from doing anything. I can subsequently use the Find orphaned files and broken links plugin to identify all empty files.

The initial difficulty is identifying which links I need to click. Coming back to those 1,300+ bites of an elephant I can instead make some smaller meals. My notes are organised into several top level folders and I can use Find orphaned files and broken links plugin with a folder filter for each meal. For example, my atlas folder contains just 297 broken links. I can probably clear that up in a few TV ad breaks.

Once I’ve finished all my elephant meals, I can remove all broken links across the whole vault using a coded solution.

But about that coding

The coding doesn’t worry at all. I’m used to creating this type of solution for this category of problem. The Find orphaned files and broken links plugin has already shown me how to identify the broken files but instead of listing them, I need to reverse the point of view and work on the source. The basic code loop is:

Identify all broken links (use Obsidian's app.metadataCache.unresolvedLinks)
For each link
    Find the files it's referenced in
    For each referencing file
        Read the contents of the file
        Replace the missing link with the link text only
        Write back the file

I am undecided about releasing the code as an Obsidian plugin. Once I’ve used it, I won’t need it again. The work it does can be considered risky and destructive (any automated file changes are) and I don’t have the time to maintain it for others. Still, it’s a way to pay it forward.