Formatting a code block in One Note
There is a tool available for formatting the code snippet in OneNote — Note Highlight project — https://github.com/elvirbrk/NoteHighlight2016
Well and good; with some added complexity of installing the plugin and so on…
Is there any alternative?
Well, not the code syntax formatting the way the plugin does but a properly indented code with a decent readability — see if that suffices for you.
Paste the code into a beautify engine such as, https://beautifier.io/
Beautify the code on the site. Copy this code.
Paste the code with Keep Source formatting option:
Select the pasted code and go to the Home tab and select the Code style for the selected code. It would look something like this:
The resultant code is readable and understandable.
Have a good day!