> For the complete documentation index, see [llms.txt](https://help.getupnote.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.getupnote.com/write-and-edit/add-content-to-your-notes/code-blocks.md).

# Code blocks

You can use UpNote to keep your library of code snippets or share them with others.&#x20;

<figure><img src="/files/av8NLlFNxktzWZvfO2Jz" alt=""><figcaption></figcaption></figure>

### On desktop

To insert a code block on Mac or Windows, simply type 3 backticks **` ``` `** or click the code block icon in the [formatting bar.](broken://pages/HW5x1P4soOaSshDTmAup)

![](/files/qehncZiY5IXhGkrOwB1S)

Syntax highlighting is supported for a number of programming languages. To change the display language of your code:

* Right click on code block > Select **`Language`**
* Select a programming language in the list

To wrap your code, go to **`Settings`** > **`Editor`** > enable **`Wrap code`**

### On mobile

To insert a code block on iOS or Android, tap the **`+`** button in the formatting bar and select **`Code Block`**

![](/files/ONbGxubLqMKFI4gvetSs)

To wrap your code, go to **`Settings`** > **`General`** > enable **`Wrap code`**

***

**FAQ:**

<details>

<summary>How to prevent the double dashes (--) to be turned into long dashes (—) in the code block on iOS?</summary>

This behavior is due to the default iOS “Smart Punctuation” feature, which automatically converts double dashes into long dashes. To prevent this, you can disable Smart Punctuation in your keyboard settings:

1. Open the Settings app on your iPhone or iPad.
2. Tap General.
3. Scroll down and select Keyboard.
4. In the “All Keyboards” section, find Smart Punctuation.
5. Turn it off (the switch will turn gray).

Once disabled, double dashes will remain unchanged in your code blocks.

</details>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://help.getupnote.com/write-and-edit/add-content-to-your-notes/code-blocks.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
