Notion is a stellar tool for programmers. Right from someone who wants to maintain a code journal to someone who wants to use it for review and technical documentation for a team, Notion finds its use with everyone.
As a coder, you can write, paste, embed, and review code in any of the popular programming languages by using the Notion code block. It is a great tool for Notion code formatting.
Here is how you can write code in Notion:
1. Go to the page where you want to add the code
Create a new Notion page to add the code block or navigate to an existing one. You can rename the page to represent the purpose of the code and also play around with it’s Share settings if you want to grant access to your team.
2. Search for the Notion Code Block
Type “/code” in the body of the page to pull up the Notion code block. You can alternatively use the Notion code block shortcut -
cmd/ctrl + option/shift + 8
to create a new code block.Here’s what an empty code block looks like.
3. Change the Code Language
Notion displays Javascript as the default language. You can change it by clicking on the drop-down at the top left of the code block and selecting the language of your code.
4. Type in Your Code
Type your code directly into the code block in the programming language of choice. You can even copy the code from another tool and paste it into the code block.
The above image shows a snippet of HTML code. You can click on “Copy” at the top-right of the code block to copy the code. You can then paste it in any tool of choice.
FAQs
What is Notion coding?
Notion coding refers to the ability to write and edit code snippets using Code Blocks in Notion across multiple programming languages. Notion also supports syntax highlighting, making it easy to read and understand code snippets.
Does Notion support code snippets?
Notion supports code snippets through its Code Block feature. You can write code captured in code blocks within your pages, and Notion will provide syntax highlighting for many programming languages.
How do you copy a code block in Notion?
Select the Notion Code Block, then press Ctrl+C (Windows) or Cmd+C (Mac) to copy it. You can then paste the code block into another page by pressing Ctrl+V (Windows) or Cmd+V (Mac).