Code syntax highlighting doesn't work well

When I copy a piece of code from my IDE (VSCode) into a code block. Every line gets an extra newline inserted.

This is on MacOS.

Also, I noticed that the syntax highlighting doesn’t seem to work well with Typescript. I start the block with ```ts. Apart from a lot of syntax sharing the same color, it breaks on string interpolation using backticks. From the first use of a backtick all content is interpreted as a string / colored red.

I was getting pretty excited when recently discovering supernotes, but code in note taking is a big part of my work, so I’m hoping these things can be solved and improved in the near future.

Since the supernotes app seems to be running on top of a web browser I think quality syntax highlighting could be handled by some 3rd party library. A lot of websites and online coding tools have great code rendering nowadays.

Hi @0x80, welcome to the Supernotes Community!

If you use the plain paste command CmdShiftV, then no new lines will be inserted.

Regarding syntax highlighting, the library we use is highlight.js, although we’re running an older version so we’ll update this and improve the highlighting for typescript in the next minor update for you :slight_smile:

Thanks @tobias! That sounds great. Looking forward to it :slight_smile:

I think this might be worth considering as a replacement for highlight.js

It appears to be more modern and has built in themes that I imagine would play nicely with the different themes that Supernotes uses.

We tried out a number of different highlighting systems over the last couple months but were not happy with the tradeoffs. For speed-highlight, we skipped it due to its lack of language support (as a regex-based parser, it is fairly difficult for them to parse certain grammars).

However we’ll make sure we keep stuff up-to-date as much as possible. I also believe that the string interpolation issue has been fixed, as I was unable to replicate myself.

Thanks for looking into it in detail! My issue seem to have been resolved indeed. Congrats on the v3 release also. Looks like I’m ready to move to Supernotes for all my note taking :slight_smile: