Code blocks – Notion Help Center (2024)

Code blocks – Notion Help Center (1)

In this Article

Code blocks are useful to demonstrate programming concepts, share code with other developers, or maintain your own library of code snippets. They also make it a breeze to copy any amount of code to your clipboard to use elsewhere 🕹️

On any Notion page, you can create a codeblockto display codeso that it's broken out from the rest of your content and formatted by language.

  • Click the+that appears to the left when you hover over a new line. ChooseCodeand pressenter. Alternatively, type/codeand pressenter.

  • With your new code block in place, click inside it to type or paste your code.

Wesupport syntax highlighting for a number of programming languages. To change the display language of your code:

  • Click the name of the language at the top left of the code block.

  • Type in the name of your programming language to search, then press enter to select.

Code blocks – Notion Help Center (3)

To eliminate side scrolling and create a line break at the edge of your code block:

  • Hover over the code block and click•••at the top right or⋮⋮on the left. You can also right click on the block itself.

  • Switch on theWrap codeoption.

Code blocks – Notion Help Center (4)

Hover over your code block to reveal theCopyand Caption buttons at the top right.

  • Click Copy, and your code is ready to paste into your editor or wherever you want to share it.

  • SelectCaptionand enter whatever you want to say about the code!

  • Click the ••• menu for even more options.

Code blocks – Notion Help Center (5)

Code blocks – Notion Help Center (6)

Note: This button is invisible to users who have "Can view" permission levels on the page.

Give Feedback

Was this resource helpful?

Code blocks – Notion Help Center (2024)
Top Articles
Latest Posts
Article information

Author: Kimberely Baumbach CPA

Last Updated:

Views: 5508

Rating: 4 / 5 (61 voted)

Reviews: 92% of readers found this page helpful

Author information

Name: Kimberely Baumbach CPA

Birthday: 1996-01-14

Address: 8381 Boyce Course, Imeldachester, ND 74681

Phone: +3571286597580

Job: Product Banking Analyst

Hobby: Cosplaying, Inline skating, Amateur radio, Baton twirling, Mountaineering, Flying, Archery

Introduction: My name is Kimberely Baumbach CPA, I am a gorgeous, bright, charming, encouraging, zealous, lively, good person who loves writing and wants to share my knowledge and understanding with you.