Multi line blockquote

Hello,

i am writing a document where i need to include code blocks code and would like those codeblocks to be blockquoted for example > code

The only way for me now is to include a > at the start of each code line, for 100 lines i have to include on each a > and it is not really practical.

Example:

> line1
> line2
...
> line 100

Is there a way to target the whole lines at once instead of adding on each a > since i am usually copy pasting and it is a nightmare to add the > on each line.

The whole idea is to have the codeblock in a blockquote and not at the beginning of line

Thank you

anyone?

To modify many lines at once you could use a text editor that allows Regular Expressions (Regex) search and replace.

You can then select the block of text you wish to edit and search for ^ (Regex for the start of a line) and replace with whatever text you wish to add, such as > (greater than and a space).

External editor vscode + column editing can solve the problem

column-select

1 Like

Can i have vscode as the default editor inside joplin?

It is a bit too much to jump around between joplin and vscode to achieve this

It can be set as an "external editor" in the General Options, under "Text editor command"..

Joplin Docs

Yes i did try that but mainly i wanted a way to stay in the built in editor that is provided by joplin when you double click on a codeblock which cant be assigned to vscode.

I only was able to go on the document and open in external editor which took me to another application on my pc

In case you use vim key-bindings, you could also use a macro

Basic syntax of a Vim macro:

qa                     Start recording a macro in register a
q (while recording)    Stop recording macro

You can choose any lowercase letters (a-z) to store macros.

To execute a macro, run the following:

@a    Execute macro from register a

So here, you could do the following. Go to the first line and type:

qai> <Esc>j0q

This will start recording into register a, insert > , then go back to normal mode, go down one line, go to the beginning and and stop recording.

(Edit: Note, <Esc> means pressing Escape, not actually typing the letters <Esc>)

To execute this 100 times, run

100@a

Here are a few additional options:

1. Use HTML blockquotes

For example,


<!-- The "markdown=1" seems to be necessary for CodeMirror syntax highlighting -->
<blockquote markdown=1>

```ts
function foo() {
    alert('test!');
}
```

</blockquote>

2. Create multiple cursors within Joplin's editor

The default markdown editor (CodeMirror 5) supports multiple cursors. To create them, hold alt+shift (should be option+shift on Mac), then click and drag.

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