Link all unlinked mentions with one click

Curious why my previous post was flagged and hidden - are ChatGPT mentions not welcome?

1 Like

Yeah why the hell was that comment flagged and hidden? I demand an explanation

This is correct. We have had to deal with numerous instances of people trying to be helpful by copying and pasting false info from LLMs. Then other users take that and run with it, causing all sorts of trouble.

Please don’t do it. Thanks for understanding!

1 Like

I’ll just add, while this is a fairly simple Python snippet that you can read and understand, you’ve posted a code snippet that you don’t necessarily understand (I don’t know you or your skill level with code). A snippet that traverses multiple directories and modifies files.

This is relatively safe. But in unskilled hands, and for someone who doesn’t have good backups, it could mangle a vault. It’s not our job as moderators to do code reviews. So yes, hallucinated GPT answers are not encouraged.

Furthermore as a Python developer, let me give some specific feedback:

  1. Why is glob imported? Because you are running code that has been blindly mushed together from multiple sources.

  2. Do you know what f.read() does? It reads the entire file into a string. On most notes this would be perfectly fine. On an enormous file, this could cause memory issues. True, it would have to be pretty huge.

A better Python pattern would be to iterate over the lines:

with open() as note:
    for line in note:
        # do your loop on each line
  1. Do you understand what the IGNORECASE flag does? It’s pretty clear by reading it that it would ignore case, right?

replaces all instances of " ProGuides " with " [[ProGuides]]

No. That is false. It would replace all instances of ProGuides, proguides, PROGUIDES or PrOGuIdEs with [[ProGuides]].

It would also replace OhWhoopsyDoodleProGuides with OhWhoopsyDoodle[[ProGuides]].

Which in this one specific example is pretty safe. But if someone was trying to replace a fairly generic word, or an easily-stemmed word, again they could mangle their vault. This wasn’t bug-tested. This wasn’t thought through. You didn’t seem to understand the code you posted.


So if you don’t know the answer to something, please don’t post a hallucinated auto-generated answer.

Did that satisfy your concerns?

3 Likes

I ran the code and it worked fine. The search string includes whitespace before and after the string so it wouldn’t replace OhWhoopsyDoodleProGuides as you suggest, as it specifically searches for the whitespace as well as the text string. I’m not an expert coder and I was just trying to help. I don’t have a problem with the post being removed and understand your policy and why you are enforcing it, but I have to say I found your reply really hostile and condescending.

No problem

Apologies to you, I can see what you mean. Most of the tone of my reply was directed at obsequious “demanding” an explanation; not at you.

I’m not trying to belittle your skill or insult you. I’m explaining why we don’t encourage GPT answers like this in general. There are consequences and potential bugs one doesn’t consider when they post code they haven’t written.

1 Like

All good, no worries.

Ryan’s reply was sufficient.

I don’t know if your answer was rude, but the censoring of Chris’s comment without explanation was rude, IMO. And Ryan addressed my concern.

Anyway, thanks.

hi,
indeed i want to start my post by saying:

time flies, now i am empowered by GPXX…, thus i can make the topic happen by myself.

HOWEVER, now i found that is not a good idea.

i got many notes, and if every item was backlinked, sometimes it make

  1. too many backlinks,
    OR 2. it become out of focus: suppose you got [[hypoparathyroidism]] and [[pseudohypoparathyroidism]], the plugin wont know how should it back link to, for a text of ‘‘hypoparathyroidism’’

so, manually backlink is a fine tune, is a preferred method for me now.
but it wont hurt if there is a button that backlink all.

1 Like

I’d be interested in a command to wrap all instances of a selected word with double square brackets without the need to manually write it in search & replace.

So the command could be added to a button somewere or a shortcut, using the editing toolbar plugin or commander or whatever else.

It would enable you to select a word, and with the click of a button, link all instances of that word.

Hey everyone, this is still an open issue that many of us want. After waiting for years, I made a quick-fix script.

I made a Python script which searches your Obsidian vault, finds unlinked references to a note, and links them, eg, Addy → [[Addy]].

This generally works. It’s hard-coded for now (but easy to change args) and requires running Python code. If anyone needs help, you can DM me.

If there is interest, I could work on making this a community plugin with a little modal for inputs. I’ve never made a plugin, so I might need help, though.

Cheers!

2 Likes

I too would find this useful, and I got an idea. If you have a short note-name, like “AI” that mangles text easily… perhaps there can be a yaml tag for that note at the top that says:

autoindex: false

or some such. Then, a function like @CLocs would have an easier time keeping things up to date. What do you think?

It’s tough to believe this isn’t a thing yet. +1. Why even bother mentioning unmentioned links when there’s nothing I can do about it IN BULK. I’m not going to spend the rest of my life linking everything everywhere. As someone who migrated from OneNote to Obsidian with nothing linked, the Graph feature is worthless when nothing is connected. I see all the pieces, but nothing to support it. Unfortunately AI isn’t useful enough to make me a solution. (I tried…)

1 Like

Another request for this feature. I agree with the previous poster: why is unlinked mentions even a thing if I cannot then bulk assign links to those unlinked mentions?

+1

would also like to see

+1 here too

+1

I ran into this several times when some new topic in my world seems to be recurring and I want to add links retroactively.