Tip - Best Way to Paste in Code

If you use your Agenda notes for programming code, like I often times do, then this tip will help you.

I have found that when I paste in code, it add an extra empty line between each line, which detracts from its usefulness for me.

Here’s what I found that works:

Copy the code
In an Agenda note, choose the Preformatted Style
Paste in the code without formatting (Command-Option-Shift-V)

This should have the desired effect of the code pasted in without extra lines.

1 Like

Good tip. That is indeed the intended way to paste code.

Note that when you paste normally, it doesn’t add an extra line, but it treats each line as a new paragraph, and paragraphs in Agenda have extra spacing.

Drew

1 Like

Is there a way to not have agenda treat each line as a paragraph, with the extra spacing? I followed the instructions in the OP, and here’s the result. I am finding it hard to use Agenda to even keep track of short snippets for this reason.

image

Not at the moment, but it is something we’re working on as we speak.

1 Like

You can use soft returns. On the Mac hold down the option key as you press enter. On iOS, there is a soft return button in the insert menu (+ button).

If you are using code, best to use the preformatted paragraph format. If you use that, the paragraph spacing is set to zero, and code looks lots better

1 Like

Ah, maybe I misunderstood. Is the problem that when you paste, it automatically inserts extra paragraphs? That could be. I think we made that change at some point to vindicate all the people copying and pasting from other apps which require an extra newline to separate paragraphs.

This was the trick. I had been using the inline code formatting (cmd-L), and had forgotten all about the block style.

1 Like

Update: Code syntax highlighting in code blocks is now possible in Agenda 15, see it in action here: