mProjectsCode / obsidian-meta-bind-plugin

A plugin for Obsidian to make your notes interactive with inline input fields, metadata displays, and buttons.
https://www.moritzjung.dev/obsidian-meta-bind-plugin-docs/
GNU General Public License v3.0
473 stars 38 forks source link

Meta Bind Embedding a note with Properties field breaks #327

Open AmericanBagel opened 4 months ago

AmericanBagel commented 4 months ago

Please fill out these Check-boxes

This Issue Occurs on

Plugin Version

1.1.0

Describe the Issue

DISCLAIMER! Involves the external plugin Excalidraw!

When using a meta-bind-embed block in an Excalidraw Markdown note to embed a note that has a Properties field (even the field is empty with no properties), the Markdown reading view renders the Excalidraw embed display instead of the note's Markdown content.

Embedding a note that has no Properties field produces expected behavior.

The issue probably lies between some strange interaction between the two plugins, but I'm posting the issue here because something about how Meta Bind is using renderMarkdown on notes with Properties is interfering with Excalidraw, and I think the issue can (maybe?) be easier fixed on the Meta Bind side.

Steps to Reproduce

  1. Create fresh vault
  2. Install and enable Excalidraw and Meta Bind
  3. Create the note Problematic Embed with a Properties field (can be empty, can have properties, makes no difference) as follows:
    
    ---

This is a problematic embed!


4. Create an Excalidraw drawing, open the Command Palette, and select `Excalidraw: Toggle between Excalidraw and Markdown mode`. Then, anywhere in the file, use a Meta Bind Embed to embed `Problematic Embed` as follows:
~~~markdown
---

excalidraw-plugin: parsed
tags: [excalidraw]

---
```meta-bind-embed
[[Problematic embed]]
The embed above will break Reading View!

Drawing

{"type":"excalidraw","version":2,"source":"https://github.com/zsviczian/obsidian-excalidraw-plugin/releases/tag/2.1.8","elements":[],"appState":{"gridSize":null,"viewBackgroundColor":"#ffffff"}}

%%


5. Switch to Reading View

Attached below is an optional **demonstration vault** I made to reproduce the bug. I recommend getting a **brief look at each file** in the vault to make sure I'm not trying to get you to run anything malicious. Then you'll have to **install Excalidraw and Meta Bind yourself** -- just a few clicks away -- since executing arbitary JavaScript in an Electron application that a stranger sent you is icky!
[demonstration vault.zip](https://github.com/mProjectsCode/obsidian-meta-bind-plugin/files/15359041/demonstration.vault.zip)

### Expected Behavior

I expected Meta Bind Embeds embedding notes with properties to not oddly interfere with the Markdown reading view on an Excalidraw Markdown note.
mProjectsCode commented 4 months ago

i haven't tested this, as I am on vacation, but if this only happens in some special excalidraw thing, then most likely excalidraw is at fault