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 button builder paste code behaving oddly within Obsidian tables [solved] #351

Closed tarathomasnow closed 3 months ago

tarathomasnow commented 3 months ago

Please fill out these Check-boxes

This Issue Occurs on

Plugin Version

1.1.1

Describe the Issue

When using meta-bind button builder from the command palette then copying & pasting the code into a table in an obsidian note, the results include <br> line break signifiers and the button doesn't render.

Specifically, I was trying to add a command button.

This issue seems the same as issue #264 but the suggested solution didn't work for me (I have tried simply removing the line breaks from the pasted code but that still doesn't work.)

Steps to Reproduce

  1. Open command palette and select Meta Bind: Open Button Builder

  2. Build a button, my example is trying to run a command to open date selector (see image)

  3. Click "Copy to Clipboard" button

  4. Paste the code into a table within an obsidian note.

  5. The button DOES work when pasted directly into an Obsidian note.

  6. When pasted into a table, it appears like this; meta-bind-button<br>label: Select Date<br>icon: calendar<br>hidden: false<br>class: ""<br>tooltip: ""<br>id: ""<br>style: default<br>actions:<br> - type: command<br> command: date-inserter:open-calendar<br><br>

  7. Even if I manually remove the <br> in a text editor and paste again, the button doesn't appear or work.

Button Builder

If I highlight the code, the code block displays correctly as per image

Highlighted

But as soon as I click out of the table, the code with line breaks <br> displays again.

I tested with all the other plugins disabled. ALL of them!

Expected Behavior

Paste the code from the button builder into the table, allowing me to use the button from within a table.

mProjectsCode commented 3 months ago

This is somewhat expected as markdown tables don't support multi-line content and code blocks are multi-line by design.

There is nothing I can do about this.

tarathomasnow commented 3 months ago

Oh!

That makes sense. I really appreciate you taking the time to explain that to me, I hadn't realised that I was trying to do something that fundamentally wouldn't work.

And thank you for such wonderful plugins!