Code fragments

Article last updated at August 11, 2026

A code fragment can be added to the text or placed in a separate block.

In text

To add a code fragment to the text, use the ` character.

`Фрагмент кода` в тексте.

Result:

Code fragment in text.

If the text contains double curly braces but does not imply variable substitution, add not_var before the construct.

The prefix not_var works only for code fragments consisting of characters .-|(),_, a-z, A-Z, 0-9 and spaces.

Tip

It is recommended to use no more than 100 characters, as text in such a fragment is not wrapped. For a larger number of characters, format the code as a separate block.

As a separate block

To format a code fragment as a separate block, separate it from the rest of the text on both sides with ``` characters.

For syntax highlighting, specify the language in which the code is written in the opening line. For example:

```sql
  price= '2000'
  size= '24'  
  color= 'primary'
  variant= 'detailed' 
```
List of supported languages
  • apache;
  • bash;
  • coffeescript;
  • cpp;
  • cs;
  • css;
  • diff;
  • go;
  • http;
  • ini;
  • java;
  • javascript;
  • json;
  • kotlin;
  • less;
  • lua;
  • makefile;
  • xml;
  • markdown;
  • nginx;
  • objectivec;
  • perl;
  • php;
  • plaintext;
  • properties;
  • python;
  • ruby;
  • rust;
  • scss;
  • shell;
  • sql;
  • swift;
  • typescript;
  • yaml.

You can find the full list of available languages in GitHub.

Displaying line numbers

If you need to enable line numbers in a code block, use the keyword showLineNumbers.

Usage example:

```sql showLineNumbers
  price = '2000'
  size = '24'  
  color = 'primary'
  variant = 'detailed' 
```

Result:

1  price = '2000'
2  size = '24'
3  color = 'primary'
4  variant = 'detailed'

Line wrapping by default

To enable soft wrap by default in a code block, use the keyword wrap.

Usage example:

``` wrap
Очень длинная строка в блоке кода, которая точно не поместится в длину, если её искусственно не свернуть
```

Result:

Очень длинная строка в блоке кода, которая точно не поместится в длину, если её искусственно не свернуть

Command line prefix

Use the parameter prompt="<value>" to exclude the command line prefix ($, #, >>>, mysql>, etc.) from selection and copying via the widget.

Usage example:

```bash prompt="$"
$ npm install
$ npm run build
```

Result:

npm install
npm run build

Tip

This feature is especially useful for snippets. If a code block contains only commands, without their output, the user can copy the entire content with one button and paste it into the terminal — without selecting lines individually.