Microsoft OneNote works great to keep all your information in a single place. You can write notes, attach files, insert tables, media, and more. But if you want to jot down bits of code? Due to the lack of syntax highlighting, you cannot store code snippets in OneNote.
Some add-ins let you insert formatted code and support many programming languages like Python, SQL, Ruby, Perl, and more. Let’s explore these add-ins and show you how to add or insert code in OneNote.
NoteHighlight2016: Syntax Highlighter for OneNote
NoteHighlight2016 is an open-source add-in for OneNote (2016 or later and Microsoft 365) that lets you insert formatted code into OneNote pages. Head to the releases page and look for NoteHighlight2016.msi under Assets (use the x86 version if you’re using 32-bit OneNote).
After installing, restart OneNote, and you’ll see a new tab at the top named “NoteHighlight.” Click on the tab to show you all the languages it supports and configure the app. By default, the add-in supports C, HTML, CSS, Python, SQL, PHP, Java, JS, and more.
Add Code Blocks in OneNote
Let’s say you want to store a code snippet in OneNote you might want to use later on. Click the NoteHighlight tab and select a language. In the pop-up window that appears, paste the code and click OK. Highlighted source code will show up on the page.
You can change the code style and choose a Box Color around the code. If the code is long, and you’ve just started learning to program, check Line Number for guidance. Read our guide on the best resources to learn code for free.
As you notice closely, the add-in acts as an intermediary, i.e., formatting code through the pop-up window.
To make any changes, you have to delete the code block and repeat the process. Despite the limitations, you’re not dumping a screenshot of code, but the actual snippet that you can use and study later on.
OneMore: Increase the Functionality of OneNote
OneMore is a free add-in for OneNote (2016 or later and Microsoft 365) that integrates with the ribbon, context menu, and keyboard shortcuts to provide you with several features to increase the functionality of OneNote.
You can create/edit custom styles for text, manage a menu of favorites to give quick access to referenced pages, save and reuse custom snippets, add formulas to table cells, many cleanup commands, and apply colorized syntax highlighting to snippets of source code. To learn more, see our complete guide on using the OneMore add-in for OneNote.
Head to the releases page and look for OneMore_[Version Number]_Setupx64.msi under Assets. “4.18” is the version number, and “Setupx64” means you’re downloading the 64-bit version of the add-in.
The add-in stores its settings in the “%AppDataRoamingOneMore” as XML files. On successful installation, you’ll see the More button in the Home tab. Now add the OneMore add-in to Quick Access Toolbar for convenience.
Writing Code in OneNote
Paste the unformatted code in OneNote and set the style (Home > Styles) to Code.
Note-Taking Apps for Coders
With these add-ins, you can easily format source code in OneNote without much configuration.
If you’re an avid OneNote user, you’ll find them helpful in your programming journey. But if you prefer something else, here are some note-taking apps designed specifically for coders.