Paste as text not returning as plain text

Things I have tried

What I’m trying to do

I’m attempting to copy/paste code snippets, but no matter if I use Ctrl + v or Ctrl + Shift + V, Obsidian will always change special characters and add several additional ones in a way that makes no sense to me. The “%” sign is giving me the most trouble, but i’m also getting a lot of additional “E’s”, brackets, parenthesis, and “3’s”

I’m brand-new to Obsidian, and have just been teaching myself as I go while I attempt to build out a Vault I can use for work.
I have never used Markdown, YAML, or anything similar to HTML. I’m using v0.14.6 on Windows 11, if that helps.

Here is what happens whenever I attempt to copy/paste:

<% tp.user.generate_periodic_link_markdown(tp, "D") %>

copying from the web gives me this result:

[](<%3C% tp.user.generate_periodic_link_markdown(tp, "D") %%3E>)

copying from another note or the same note gives me this result:

[](<%3C% tp.user.generate_periodic_link_markdown(tp, "D") %%3E>)

The “%” symbol never gives me issues when I copy/paste unless it’s a code snippet. Everything works as expected, and I’ve seen so many people copy/paste in walkthroughs and demos with no issues, so I have no idea why I’m experiencing this.

This happens regardless of whether I’m using Templates, Templater, or just typing notes.

Could someone please help provide some insight or guidance on how to avoid this? It’s becoming prohibitively time-consuming, especially as someone who isn’t super familiar with code and who’s just trying to learn as I go.

Hi @CarnageAsada

judging by the [] at the beginning of the lines you posted it looks like obsidian is seeing what you are pasting as a web link instead of plain text.

The %3C and %3E are < and > as encoded in HTML URL encoding

So basically if we remove the obsidian markup for a link []() and replace the html encoding, what is being pasted is:

<<% tp.user.generate_periodic_link_markdown(tp, "D") %>>

which is close to what you are copying

<% tp.user.generate_periodic_link_markdown(tp, "D") %>

Which OS/Browser are you on? Do you have any plugins in the browser/obsidian that might modify the clipboard?

On Windows with Chrome I pasted <% tp.user.generate_periodic_link_markdown(tp, “D”) %> and it came out fine. I copied it from your post though, what is the link to the website where that line of code is from?

In googling I found this site Daily and Weekly Notes - any day from calendar · Discussion #568 · SilentVoid13/Templater · GitHub with that line, is this where you copied from? If so using Chrome and Edge on Windows 10 when I copied/pasted into latest version of Obsidian it pasted it as a code block with no markup for link or URL Encoding.

Basically it seems like we need to figure out why Obsidian thinks a link is being pasted.

Looking in the Obsidian help file it looks like the link []() and extra < and > characters I mentioned here:

Are due not to a regular link but an Obsidian URI Link.

Obsidian URI links

[[Using obsidian URI|Obsidian URI]] links can be used to open notes in Obsidian either from another Obsidian vault or another program.

For example, you can link to a file in a vault like so (please note the [[Using obsidian URI#Encoding|required encoding]]):

[Link to note](obsidian://open?path=D:%2Fpath%2Fto%2Ffile.md)

Link to note

You can link to a note by its vault name and file name instead of path as well:

[Link to note](obsidian://open?vault=MainVault&file=MyNote.md)

Link to note

Escaping

If there are spaces in the url, they can be escaped by either using %20 as a space, such as:

[Export options](Pasted%20image)

Export options

Or you can enclose the target in <>, such as:

[Slides Demo](<Slides Demo>)

Slides Demo

Either way we still need to we need to figure out why Obsidian thinks a URI link is being pasted.

Have you got any plugins installed, which might be overriding the default paste behaviour? Paste link into text?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.