Sunday, February 19, 2023
Applies colorized syntax highlighting to selected source code. Supported languages include
For best results, first select the text you want to colorize, set the style to Code, and then colorize the selection.
Language selection is done by click the More menu and then the Colorize menu. But there is a faster keyboard shortcut to open the Select Language dialog
Press Alt + C
You can quickly get to a language by typing the first letter of its name and apply syntax highlighting by pressing Enter. Close the dialog and cancel the action by pressing Esc.
The highlighting is not as complete as you might find in VS or VSCode but then OneNote isn't intended to be a programming editor anyway.
The parser will colorize one paragraph at a time. For example, an XML opening tag and its attributes must all appear in one contiguous paragraph or they will be ignored.
street="123 Main St"
Since that XML is spread across three separate lines (three paragraphs in OneNote) it will not be recognized as XML. But if it were on a single line, then it will be recognized, such as
<address street="123 Main St" city="Anytown" />
Languages are defined in JSON definition files located below the OneMore installation directory so they can be customized and enhanced and new languages can be added. If you're so inclined to add enhancements or define a new language, please submit a pull request.
© 2020 Steven M Cohn. All rights reserved.
Please consider a sponsorship or one-time donation to support ongoing development
Created with OneNote.