A simple way to Code Syntax HIghlight...No extension required !
I was searching for any extension that can help me format my code on my OneNote Mac, but I failed. Now finally I discovered a way to do it.
If you want to paste a code from any source into your onenote with all the syntax and formatting highlight intact, heres a simple solution.
Here's the trick:
Visit the stack overflow site and in the reply section, paste your code in the CODE block, after this stackoverflow will show you the preview of your code in Syntax highlighted manner.
Now just code from the preview and paste in OneNote.....DONE !!
OneNote now shows the exact code snippet as that of the StackOverflow after pasting.
This worked for me, hope this helps.
Matt Wilkie commented
This is a usuable work around, but I'd much rather use a keyboard combination, similar to Ctrl-Alt-1 for headings and Ctrl-Shift-N for Normal Paragraph.
all this is only considered convenient in the world of microsoft
Sergey Gumenyuk commented
Guys! It have embedded "Code" formatting in Styles. It not highlight a code, but at least not break formatting.
dude. there are much easier ways.
Best for me is Visual Studio Code. It's free. It might be better than onenote for your purposes.
Turn on right text copy/pasting and it'll paste exactly as you see. Colors and all.