Code blocks

ื‘ืžืกืžืš ื”ืขื–ืจื” ื”ื–ื”

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 codeย blockย to display codeย so 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. Chooseย Codeย and pressย enter. Alternatively, typeย /codeย and pressย enter.

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

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

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

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

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

  1. Hover over the code block and clickย โ€ขโ€ขโ€ขย at the top right orย โ‹ฎโ‹ฎย on the left. You can also right click on the block itself.

  2. Switch on theย Wrap codeย option.

Hover over your code block to reveal theย Copyย and Caption buttons at the top right.

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

  2. Selectย Captionย and enter whatever you want to say about the code!

  3. Click the โ€ขโ€ขโ€ข menu for even more options.

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


ืžืชืŸ ืžืฉื•ื‘

ื”ืื ื”ืžืฉืื‘ ื”ื–ื” ื”ื™ื” ืฉื™ืžื•ืฉื™?


Powered by Fruition