shabegom / buttons

Buttons in Obsidian
The Unlicense
478 stars 50 forks source link

Clash with another plugin - 'Filename Heading Sync' and replace [1, 9999] question #68

Closed adxsoft closed 8 months ago

adxsoft commented 3 years ago

I have these two buttons below on an Obsidian Note. My goal was that each button when pressed will execute a python script and clean up any templater code inserted into the page and leave a 'clean' display of the two buttons.

The issue (not yours) I found is that it is necessary to turn off the community plugin 'Filename Heading Sync' which was throwing out the replace activity for some reason.

The replace [1, 99999] works perfectly and removes the inserted templater code by either button.

My question is why does replace [1, 9999] not destroy the second button? Does it take a full snapshot of the page prior to the templater script execution? I was confused by the documentation.

I'm not complaining because my use case works perfectly and I have a page called command centre (below) that now has lots of buttons for my scripts which is great.

Thanks for your excellent work in bring Buttons plugin to the community.

Button 1

name run My Schedule type line(99999) template action Run Python Script For Schedule templater true color yellow replace [1, 99999]

Button 2

name run Project Review type line(99999) template action Run Python Script For Project Review templater true color blue replace [1, 99999]

The Obsidian Note - Command Centre 07 - Command Centre.md

shabegom commented 2 years ago

I think the issue is that it is grabbing both buttons prior to templater execution and then replacing both into the note afterwards assuming they need to be reverted.

It is challenging to sort out just the templater buttons from everything else. that code is basically spaghetti right now.. :sweat_smile: