# Code

A wide variety of programming languages and basic code editing is supported in code blocks.

# Inserting

As always, there are several options for adding code blocks into your document:

* Use the markdown shortcut ```` ``` ```` . After the backticks type a space character to insert a code block in the last language used, or a language such as “typescript" to insert a code block of that type.
* Type `/code` to see the block menu option
* Paste code from another editor

## Examples

Typescript

```typescript
const counter = function() {
    let count = 0;

    return function(): number {
        return ++count;
    }
}; 
```


Other formats such as “diff” are also supported:

```diff
@@ -37,7 +37,7 @@ sql {
        #       sqlite
        #       mongo
-       dialect = "sqlite"
+       dialect = "postgresql"
```

## Pasting

When code is pasted from VSCode and other compatible editors and sources the language will be **automatically detected.** If a language is not detected then the last used language will be used.

# Options

## Language chooser

It’s also possible to choose the language manually from the menu that appears when focused in a code block.

## Line wrap

 ![Line wrap control](https://outline-production-attachments.s3-accelerate.amazonaws.com/uploads/292079f8-0319-4111-bb5b-315e8ae8f14e/670c37b0-c11d-4d3f-b9c2-99514fcaf5c1/image.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIA4EOUDTOVUICLPZ4P%2F20261017%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20261017T060000Z&X-Amz-Expires=86400&X-Amz-Signature=f17005e4450bee51caac7a05b3c338bf14a356a2525dc951394bc33d86a1c18f&X-Amz-SignedHeaders=host&x-amz-checksum-mode=ENABLED&x-id=GetObject " =251x79")

Line wrap can be enabled on each code-block from the icon in the floating menu. Line numbers can be disabled as a personal preference in **Settings → Preferences** if you prefer.

## Copy

A quick button for copying the content of the block to the clipboard.

---

**Documents**

- [Getting started](https://docs.getoutline.com/s/guide/doc/getting-started-CB6Ipl9Cdc)
- [Documents](https://docs.getoutline.com/s/guide/doc/documents-UiH1h0aQFQ)
- [Integrations](https://docs.getoutline.com/s/guide/doc/integrations-eUbAF2WAjF)
- [AI](https://docs.getoutline.com/s/guide/doc/ai-IFCYbrK7EU)
- [Administration](https://docs.getoutline.com/s/guide/doc/administration-GmaueCNdk1)
- [Import data](https://docs.getoutline.com/s/guide/doc/import-data-D2ZvLqz411)
- [Export data](https://docs.getoutline.com/s/guide/doc/export-data-Da6C7HqL8M)
- [Cloud hosting](https://docs.getoutline.com/s/guide/doc/cloud-hosting-CxJbubIhje)