obsidian-meta-bind-plugin icon indicating copy to clipboard operation
obsidian-meta-bind-plugin copied to clipboard

Silently ignore embed of non-existent link

Open anoldgreydog opened this issue 10 months ago • 2 comments

Is your Feature Request Related to a Problem?

I think this is a behaviour change in a recent update - I'm not sure when, though.

I use meta-bin-embed to insert optional extra sections in notes that can be overwritten from external sources. In the past, if there was nothing to embed, the note would just look as if there was nothing there but now it contains an ugly "[META_BIND_ERROR]" message where the extra file would have been embedded.

For example, in "mynote.md":

Some text generated from an external source...

```meta-bind-embed [[mynote extras]] ```

More text from external source

Now, if "mynote extras.md" doesn't exist, you get

Some text generated from an external source...

(!) [META_BIND_ERROR]

More text from external source

whereas what I'd like is:

Some text generated from an external source...

More text from external source

Describe the Feature you'd Like

Could we have an option to silently ignore non-existent files when embedding, please?

Additional Context

No response

anoldgreydog avatar Apr 17 '24 16:04 anoldgreydog

The embed erroring is the intended behavior. That being said I can see there being some sort of syntax to tell the embed to not error when the file is not found. I have no idea how that syntax could look though, as it can't break existing embeds.

mProjectsCode avatar Apr 19 '24 15:04 mProjectsCode

The embed erroring is the intended behavior. That being said I can see there being some sort of syntax to tell the embed to not error when the file is not found. I have no idea how that syntax could look though, as it can't break existing embeds.

Thanks for the reply. Am I misremembering that it used to silently ignore missing notes? I'm sure I remember when I first used it thinking that that was an added bonus over the standard method of embedding.

If we could have something like

```meta-bind-embed nowarn [[my-file]] ```

that would be awesome.

Or even a separate command like meta-bind-embed-silent, maybe.

Anyway, thanks for your time. I might just have to create lots of empty files...

anoldgreydog avatar Apr 19 '24 20:04 anoldgreydog

I made the messages for embeds a bit nicer, but I am unsure if I want to add what you requested as a feature to individual embeds. Maybe a global setting would suffice?

mProjectsCode avatar Sep 14 '24 10:09 mProjectsCode

No, it's fine. I've got used to using a template to insert the code when I need it. Thanks for looking at it, though.

anoldgreydog avatar Sep 14 '24 16:09 anoldgreydog