nmcarp99 / Obsidian-Auto-Definition-Link

This is a plugin for Obsidian to automatically create links to blocks in your vault
MIT License
6 stars 0 forks source link

Not sure it's working... #1

Closed huachuman closed 8 months ago

huachuman commented 9 months ago

Do you have a short video of how this works? Nothing seems to be happening.

e.g. using the lightweight utility GifCam https://blog.bahraniapps.com/gifcam/

nmcarp99 commented 9 months ago

If it's not working, have you tried refreshing the links? There's a button in the bottom right menu and a command to do so. I would be willing to jump on a Discord chat if that doesn't work. GIF 2-4-2024 2-56-20 PM

huachuman commented 9 months ago

Hmm.. I feel like I'm missing something..

GIF 2-5-2024 7-40-02 AM

Refreshing the links doesn't seem to change anything.

All the switches are turned on in settings, if that makes any difference.

nmcarp99 commented 9 months ago

I'm not sure... It seems to be working from a clean install for me.

How are you installing it?

GIF 2-5-2024 10-18-39 AM

huachuman commented 9 months ago

Ok I just checked and when I install it to a sandbox vault it definitely works fine.

But for some reason in my main vault it doesn't. Now get this: Somehow after disabling ALL other plugins, it still doesn't work. Changing the theme doesn't help either. Now that's WEIRD. I wonder what's going on.

huachuman commented 9 months ago

Could it be related to this?

image

nmcarp99 commented 9 months ago

According to that it is still trying to look through your vault... That's weird because I set up a test vault with 25k files and it finishes in about ~50ms... Does it stay frozen at that number or did you just send a picture while it was searching?

huachuman commented 9 months ago

It's stuck there. I've tried using the refresh command but it never seems to search more than that.

huachuman commented 9 months ago

Looks like a problem with some of my notes then, I suppose... that would explain why the vault with disabled plugins would still throw this issue.

There's a bunch of errors in the console. Here's a sample:

plugin:auto-definition-link:1 Uncaught (in promise) TypeError: contents.map is not a function at processFileContents (plugin:auto-definition-link:1:13623) at eval (plugin:auto-definition-link:1:12058) processFileContents @ plugin:auto-definition-link:1 eval @ plugin:auto-definition-link:1 Promise.then (async) eval @ plugin:auto-definition-link:1 eval @ plugin:auto-definition-link:1 updateBlockIds @ plugin:auto-definition-link:1 onload @ plugin:auto-definition-link:1 await in onload (async) e.load @ app.js:1 (anonymous) @ app.js:1 (anonymous) @ app.js:1 (anonymous) @ app.js:1 a @ app.js:1 Promise.then (async) l @ app.js:1 (anonymous) @ app.js:1 v @ app.js:1 e.loadPlugin @ app.js:1 (anonymous) @ app.js:1 (anonymous) @ app.js:1 (anonymous) @ app.js:1 (anonymous) @ app.js:1 v @ app.js:1 e.enablePlugin @ app.js:1 (anonymous) @ app.js:1 (anonymous) @ app.js:1 (anonymous) @ app.js:1 (anonymous) @ app.js:1 v @ app.js:1 e.enablePluginAndSave @ app.js:1 eval @ plugin:quick-plugin-switcher:3573 wrapper @ plugin:quick-plugin-switcher:356 (anonymous) @ app.js:1 (anonymous) @ app.js:1 (anonymous) @ app.js:1 (anonymous) @ app.js:1 v @ app.js:1 (anonymous) @ app.js:1 t.setValue @ app.js:1 t.onClick @ app.js:1 app.js:1 Uncaught (in promise) YAMLParseError: Unexpected seq-item-ind token in YAML stream: "-" at IE.next [as push] (app.js:1:808482) at IE.stream (app.js:1:823827) at IE.step (app.js:1:821710) at IE.next [as push] (app.js:1:820848) at ME.pushCount (app.js:1:817618) at ME.parseBlockStart (app.js:1:813545) at ME.parseLineStart (app.js:1:813379) at ME.parseDocument (app.js:1:813892) at ME.parseNext (app.js:1:812100) at ME.lex (app.js:1:810988) at IE.parse (app.js:1:821470) at app.js:1:831353 at OE (app.js:1:831445) at aN (app.js:1:1574816) at processFileContents (plugin:auto-definition-link:1:13563) at eval (plugin:auto-definition-link:1:12058) next @ app.js:1 stream @ app.js:1 step @ app.js:1 IE.next @ app.js:1 pushCount @ app.js:1 parseBlockStart @ app.js:1 parseLineStart @ app.js:1 parseDocument @ app.js:1 parseNext @ app.js:1 lex @ app.js:1 parse @ app.js:1 (anonymous) @ app.js:1 OE @ app.js:1 aN @ app.js:1 processFileContents @ plugin:auto-definition-link:1 eval @ plugin:auto-definition-link:1 Promise.then (async) eval @ plugin:auto-definition-link:1 eval @ plugin:auto-definition-link:1 updateBlockIds @ plugin:auto-definition-link:1 onload @ plugin:auto-definition-link:1 await in onload (async) e.load @ app.js:1 (anonymous) @ app.js:1 (anonymous) @ app.js:1 (anonymous) @ app.js:1 a @ app.js:1 Promise.then (async) l @ app.js:1 (anonymous) @ app.js:1 v @ app.js:1 e.loadPlugin @ app.js:1 (anonymous) @ app.js:1 (anonymous) @ app.js:1 (anonymous) @ app.js:1 (anonymous) @ app.js:1 v @ app.js:1 e.enablePlugin @ app.js:1 (anonymous) @ app.js:1 (anonymous) @ app.js:1 (anonymous) @ app.js:1 (anonymous) @ app.js:1 v @ app.js:1 e.enablePluginAndSave @ app.js:1 eval @ plugin:quick-plugin-switcher:3573 wrapper @ plugin:quick-plugin-switcher:356 (anonymous) @ app.js:1 (anonymous) @ app.js:1 (anonymous) @ app.js:1 (anonymous) @ app.js:1 v @ app.js:1 (anonymous) @ app.js:1 t.setValue @ app.js:1 t.onClick @ app.js:1 3plugin:auto-definition-link:1 Uncaught (in promise) TypeError: contents.map is not a function at processFileContents (plugin:auto-definition-link:1:13623) at eval (plugin:auto-definition-link:1:12058)

...

app.js:1 Uncaught (in promise) YAMLParseError: Unexpected double-quoted-scalar at node end at line 1, column 8:

tags: "#researchnotes" "#neuroanatomy" ^

at onError (app.js:1:807647)
at l (app.js:1:802651)
at rE (app.js:1:794818)
at sE (app.js:1:804001)
at pE (app.js:1:804949)
at gE (app.js:1:806740)
at app.js:1:795994
at oE (app.js:1:796245)
at gE (app.js:1:806816)
at app.js:1:808012
at IE.next [as push] (app.js:1:808154)
at IE.pop (app.js:1:822341)
at IE.end (app.js:1:821530)
at IE.parse (app.js:1:821487)
at app.js:1:831353
at OE (app.js:1:831445)
at aN (app.js:1:1574816)
at processFileContents (plugin:auto-definition-link:1:13563)
at eval (plugin:auto-definition-link:1:12058)
nmcarp99 commented 9 months ago

Is it possible your source code looks something like this?

---
tags: "#researchnotes" "#neuroanatomy"
---

If so, the error is in your formatting. That is not valid YAML. When the plugin tries to scan for aliases, it fails when parsing the YAML block. I will add some error handling to make this a better experience.

It should be as the following:

---
tags:
  - "#researchnotes"
  - "#neuroanatomy"
---
nmcarp99 commented 9 months ago

It also might be helpful to note that disabling the Search file content option will ignore all file content including the aliases. While you fix your notes (or if for any reason you want to keep your frontmatter in its current structure), you can disable this and it should scan fine. However, disabling this option will also only include file names instead of specific blocks to link to.

huachuman commented 9 months ago

Thanks. I would just mention that it's considered valid by Obsidian and works as intended in that format. In fact it's needed for certain plugin functionality but I won't get into it here.

huachuman commented 8 months ago

I managed to fix the plugin so that it works with the "invalid" yaml by asking copilot

jsmm commented 8 months ago

Hi. This plugin doesn't work for me either, although I haven't noticed any other issues when working with my vault.

imagen