Forum Discussion
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 answer says its been requested on UserVoice and directs OP there, but 3 years later, still no code block formatting options and Microsoft isn't using UserVoice anymore so I don't where else I can submit feature requests besides this discussion board.
Thanks!
24 Replies
- gkbrenneCopper ContributorI just tried "OneMore" by Steven Cohn and I'm impressed: https://onemoreaddin.com/get-started/Welcome%20to%20OneMore.htm. This works with OneNote 365 v2306 build 16529.20182
You might also try NoteHightlights 2016 by Elvir Brkić at https://github.com/elvirbrk/NoteHighlight2016 - marcvanbreemenCopper ContributorFor 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.- hifeinsteinCopper 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.
- bbetnarCopper Contributor
The 1x1 table is actually a genius workaround. Extremely quick and simple. Clever thinking. Thanks!