Use code block formatting

Use code block formatting and our syntax highlighting will interpret more than 30 coding languages.

What you'll need

Use code block formatting

You can type or paste code into tasks, subtasks, Docs, wikis, Whiteboards, columns, Chat view, text block Dashboard cards, and Notepad:

  1. Navigate to the location you're adding a code block to.
  2. Paste a code block into the text editor. You can also use the /Slash Command /co and begin typing.
  3. Above the upper-left corner of the code block, click the language dropdown.
  4. Choose a language.
  5. Your code block will format according to the language.
    • To copy the code block, hover in the upper-right and click Copy.
    • To select the entire code block without selecting any other content, press Cmd + A or Ctrl + A.
    • To exit the code editor, press Return three times.

Supported languages

The following languages are supported:

  • Bash
  • C++
  • C#
  • CSS
  • Dart
  • Diff
  • Elixir
  • Erlang
  • Gherkin
  • Go
  • Haskell
  • Java
  • JavaScript
  • JSON
  • Kotlin
  • Less
  • Markdown
  • Mermaid
  • Perl
  • PHP
  • Plain text
  • Python
  • R
  • Ruby
  • Rust
  • Scala
  • Scheme
  • SCSS
  • SQL
  • Swift
  • TypeScript
  • HTML/XML
  • YAML

Show Mermaid code as a diagram

Mermaid is a language that draws flowcharts, sequence diagrams, and more from text. A code block set to Mermaid shows the diagram with your code.

Mermaid diagrams are part of ClickUp Labs. To use them, join Labs and turn on Mermaid diagrams.

To show Mermaid code as a diagram:

  1. Add a code block in a Doc, comment, or Chat message with the /Slash Command /co.
  2. Above the upper-left corner of the code block, click the language dropdown.
  3. Select Mermaid.
  4. Type or paste your Mermaid code.
    • If the language is set to Auto-detect, the code block switches to Mermaid when the first line names a diagram type, such as graph TD.

If your code has an error, the code block shows the error and the line it's on.

Choose what a Mermaid code block shows

Your choice applies to every Mermaid code block in your browser.

To choose what a Mermaid code block shows:

  1. Click the Mermaid code block.
  2. Above the upper-left corner of the code block, click the Both dropdown.
  3. Select an option:
    • Both
    • Diagram
    • Code

When Diagram is selected, click the diagram to edit its code.

In Chat messages and comments, a posted Mermaid code block shows only the diagram. To see the code, click Show code below the diagram.