Logo Trilium Demo

Code blocks

Code blocks are useful to add short snippets of code blocks inside text notes. Depending on your preference, it's possible to enable or disable word wrapping for these code blocks.

We added syntax highlighting to code blocks as well. When a code block is first created it will try to automatically determine the programming language, should that fail it is possible to manually adjust it. The color scheme for the syntax highlighting is adjustable in settings. 

function helloWorld() {

	alert("Hello world");

}

For larger pieces of code it is better to use a code note, which uses a fully-fledged code editor (CodeMirror). For an example of a code note, see Custom request handler.