Code Block

Enable line number

By default line numbers are not showed in code blocks. You can enable it by customize CSS variables:

1
--enable-code-line-number: true;

When using tab to indent lines in clode block, line numbers will be indented too bacause of OneNote’s limit. Don’t worry, numbers will be automatically corrected when hitting Ctrl + Enter to exit editing.

Force highlighting

When typing code line by line, some code may get the wrong syntax color, especially in multi-line comments. Don’t worry, when hitting Ctrl + Enter to exit block, all the lines will be forced to highlight again. You can also trigger this by hitting F5.

Change code theme

OneMark use highlight.js to highlight code. You can choose a theme from the gallery, view the source and paste it into theme .css file or __gloabl.css.

OneMark also supports CodeMirror themes.