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.
This is workaround, not solution! And this only shows how Microsoft is lazy in requested feature delivery. I have surface book and i really wanted to use OneNote, but this is game changer for me and onenote never will be anything more than hand drawing app for me, despite having enormous potential to crush competition with recent modern look. I can live without markdown, but I cannot live without code highlights, how can i read my notes if i can't even see the code chunks properly???
Ľudovít Priezviskoo commented
past it to word and copy/past it to onenote, after this it wil have sql formatting.. simple way :-)
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.