Cannot insert js code in document without scr... up the rest of the note

What am I trying to do:
I am moving my info-collection to Obsidian, from Dynalist, FreePlane etc. Amongst other things, there are also some bookmarklets for browsers, written in javascript. I am trying to add them to a note, however after pasting the code, the rest of the text appears in red-font.

What I have tried: Looked at the help file, regarding code blocks. I put ‘’‘js at the beginning (3 ticks followed by js), Paste the code block as Text, the last line I put ‘’’ (3 ticks).
I tried also indenting the first line of the code, putting \ at the beginning and at the end of the block, nothing helps. As soon as I start writing again, the font is red.

Is there a way to tell Obsidian something like “from here on, don’t try to be smart, just treat the text as text, and nothing else”??

I love so much about Obsidian, the only thing that I strugle with are those markdown conventions which are so strange to me.

Additional info: the code of the bookmarklet (and bookmarklets in general) is something of a “spaghetti like code” - all in one block of text.

Can anybody help?

Things I have tried

What I’m trying to do

On the forum, your ticks look like single speech marks. You need backticks.

The closing backticks should be on their own line. For example:

```js
On the forum, your ticks look like single speech marks. 
You need backticks.

The closing backticks should be on their own line. 
```

Works?

Angel

You really are an angel :slight_smile:
Thank you very much, it worked.
I did use the single speech mark. How embaressing.

Thanks again!

Good to hear it is working for you. I originally made the same mistake with single speech marks. :blush:

Angel

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