Code

Inline and Highlighted Code Blocks

Updated over a week ago

Writing code in Supernotes is seamless, and we've added a lot of functionality for both new and long-term developers to take advantage of. Including syntax highlighting, multi-cursor support, and auto-indentation.

Inline Code

It is easy to add code within a card. For inline code, surround it with a backtick, ` .

Code Blocks

Code blocks offer you even more control. Use three backticks ``` on a new line to denote the start of a code block and three backticks after on a new line to denote the end of a code block.

Syntax Highlighting

In the example above, you will notice the name of the language appends the first three back-ticks. By defining the language used, this allows Supernotes to highlight the syntax of the code block for you.

The following languages are supported (uncollapse to view)

  • actionscript

  • ada

  • apache

  • applescript

  • arduino

  • bash

  • c

  • capnproto

  • clojure

  • coffeescript

  • cpp

  • crystal

  • csharp

  • csp

  • css

  • d

  • dart

  • diff

  • dockerfile

  • elixir

  • elm

  • erb

  • erlang

  • excel

  • fortran

  • fsharp

  • go

  • gradle

  • groovy

  • handlebars

  • haskell

  • haxe

  • http

  • ini

  • java

  • javascript

  • json

  • julia

  • kotlin

  • latex

  • less

  • lisp

  • lua

  • makefile

  • markdown

  • matlab

  • nginx

  • nim

  • nix

  • objectivec

  • ocaml

  • perl

  • pgsql

  • php

  • processing

  • profile

  • properties

  • protobuf

  • puppet

  • python

  • r

  • ruby

  • rust

  • scala

  • scheme

  • scss

  • shell

  • sql

  • swift

  • typescript

  • xml

  • yaml

Multi-Cursor Support

Highlight a word that appears more than once press Cmd / Ctrl + D (or Cmd / Ctrl + click) to create multiple cursors. Now you can edit the same word or phrase in one go.

Auto-indentation

Code blocks support auto-indentation, saving you from tapping space or tabbing lots! Like the example here:

You can even set a preference for your preferred indentation (two-spaces, four-spaces and tabs!)

Did this answer your question?