How To Properly Format Code In OneNote

OneNote has come a long way since it’s release. It started out as a very basic note taking app. It’s had improved over the years and holds up reasonably well against the likes of Evernote. Microsoft’s productivity suite is also incredibly popular on desktops and OneNote is a part of it. The latest version is pretty awesome allowing you to insert recordings, audio, and even spreadsheets from Excel. It meets most note taking requirements and missing features are made up for by add-ons. Almost all apps in MS Office have their own set of add-ons and OneNote is no different. If you use OneNote to store bits of code, NoteHighlight2016 is an add-on you should try. It lets you properly format code in OneNote and supports C#, CSS, SQL, JS, HTML, XML, Java, PHP, Perl, Python, Ruby, and CPP.

Format Code In OneNote

NoteHighlight2016 is an open source add-on. Download it from Github and run the MSI file. It takes care of the entire installation process. You won’t have to enable it like you might in other office apps. Once installed, open OneNote and you’ll see a new tab named ‘NoteHighlight’.

This tab shows you all the languages it supports. The add-on will not correctly format the code unless you select the correct language.

When you select a language, a new windows opens. Paste the code in this window and make sure you check the ‘Copy to Clipboard’ option. When you enable this option, any code you paste in the NoteHighlight box is formatted and then automatically copied to your clipboard. If you don’t enable the option, you will have to manually copy the formatted text.

Open a notebook and paste the code in a note. It will retain its formatting.


NoteHighlighter lets you format code in OneNote but it doesn’t add the functionality inside the note taking interface. There is an intermediary i.e., the box that opens when you select a language. If you attempt to edit the code snippet you paste in a note, it doesn’t recognize and format the code. If you want to make any changes to the code snippet you’ve pasted and retain its formatting, you will need to go through the NoteHighlight tab again.

The add-on recognizes the code syntax and then formats it for OneNote using the built-in text formatting styles. You can always change the formatting by selecting it and using the Basic Text tools on the Home tab. The add-on works in OneNote 2016.