Syntax highlighting for code blocks

I use Dynalist to store code snippets and notes about code. Currently, a code block like this:

```fun add(x: Int, y: Int): Int {
    return x + y
}

add(2, 4) // 6```

Is displayed like this:

00

My preferred scenario would be to support language names like in MarkDown and have this:

```kotlin
fun add(x: Int, y: Int): Int {
    return x + y
}

add(2, 4) // 6
```

Look a little more like this:

42

19 Likes

I always wonder why this is forgotten, I mean this is build by developers right?
We could use a bit more developers love :slight_smile:

6 Likes

+1, need code highlighting very much.

1 Like

How do you get that code block to work? I canā€™t even get that to work.

1 Like

Look in your keymap: :slightly_smiling_face:

image
It is a weird shortcut for non english keyboard. You could just type two times `` as well.

Code highlighting has now arrived, and itā€™s great, but the back-tick character really is inaccessible on non-English keyboards. Iā€™d welcome an option to customize a Dynalist keyboard shortcut that would insert three back-ticks that are now needed for multi-line code blocks. As it is, I have set up an AutoHotKey keyboard shortcut on Windows to insert the three back-ticks for me.

In my humble opinion, this responsibility doesnā€™t belong to the program but the OS.

Iā€™m a US International keyboard layout user which has the ā€˜inaccessibleā€™ behaviour I think you might be referring to. Simply pressing ā€œ`ā€ (top left most character right under the escape button for me) followed by a space for one single back tick or three presses followed by a space for three has always worked perfectly for me.

Your AHK solution sounds perfect and like the perfect way and place to solve an issue that you donā€™t have with the app but with the OS youā€™re running the app on.

Well, I would still welcome the opportunity to set up my own keyboard shortcut for inserting three back-ticks, just like itā€™s possible to set up your own keyboard shortcuts for many other things in Dynalist, such as for inserting the bold or italic markdown ā€“ or a single back-tick!

But this is brand-new Dynalist functionality, just introduced a few days ago, so perhaps the option to set up a customized keyboard shortcut for inserting three back-ticks will be added to Dynalist a bit later on. :slightly_smiling_face:

2 Likes

+1 i need a shortcut too. thanks.

1 Like

Iā€™d like to give my thanks and appreciation to @Shida and @Erica. I really appreciate your hard work making this feature happen :smiling_face_with_three_hearts:. Being a developer with bad memory, I rely on google and a code snippet manager. I already had a ton of snippets in Dynalist but now with code highlighting itā€™s twice the fun using it!

6 Likes

@Shida There is no way edit code block as far as I can tell.

If I paste a code block, I am not able to add new lines to it. It just jumps to another bullet-point.

@Gajus_Kuizinas some good ppl told me here that itā€™s actually possible: ctrl-shift-enter makes new line without creating new node