chhoumann / quickadd

QuickAdd for Obsidian
https://quickadd.obsidian.guide
MIT License
1.53k stars 136 forks source link

[BUG] Quickadd is executing Templater snippets I have in my note #715

Open NeighNeighNeigh opened 3 months ago

NeighNeighNeigh commented 3 months ago

Describe the bug I have notes that include Templater (plugin) code snippets I keep for reference. When I use Quickadd (capture mode) to insert content into these notes, the Templater code is executed and the content of the code blocks is deleted.

To Reproduce Steps to reproduce the behavior:

  1. Create a new note with the following code block (ensure to encapsulate it with triple backticks)
<%*
alert("hello")
%>

It should look like this in your note:

image
  1. Use Quickadd (capture mode) to insert some content into your note.
  2. Notice, the javascript is executed and the contents of the code block is deleted.

Expected behavior Quickadd will add the content to the note and not execute any existing code blocks within the note.

Desktop (please complete the following information):

Smartphone (please complete the following information):

josephtribulat commented 1 month ago

I notice the same behavior. I don't use the Assistant very often so I'm not sure when this began.

I'll add that when I ask the Assistant for some code, then that code itself gets executed and is removed from the printed output. For example, this prompt:

Please write a templater script that displays an alert with the text "Hello World!". Format it properly, with <%* at the beginning and %> at the end, so I can run it as is.

...will result in the alert popping 2 times, and then something like this in the note:

Here’s the templater script that displays an alert with the text "Hello World!":

```markdown