Forum Discussion
alex-franco
Jun 22, 2021Copper Contributor
OneNote - Inserting Code Blocks
Are there any plans for a way to format code blocks in OneNote without inserting a 1 column/row table or an ugly print out? The most relevant Google search brings up a post from 2018 where the top an...
marcvanbreemen
Sep 01, 2022Copper Contributor
For now you can do this:
Paste your code in Visual Code. Be sure that the language is supported and/or install support for it first (extension). Your code will be color coded.
Then copy/paste ("with format" option) that in OneNote.
Paste your code in Visual Code. Be sure that the language is supported and/or install support for it first (extension). Your code will be color coded.
Then copy/paste ("with format" option) that in OneNote.
- hifeinsteinFeb 10, 2025Copper Contributor
If you want the code to visually look like an isolated code block in-line with other notes in the same text box, select the pasted code and insert a 1x1 table. Clunky, yes but it’s a decent workaround for isolating code blocks similar to how other note taking apps do it. Add shading and it really pops.
- bbetnarMay 31, 2025Copper Contributor
The 1x1 table is actually a genius workaround. Extremely quick and simple. Clever thinking. Thanks!