Syntax Highlighting
Hyvor Blogs has a powerful syntax highlighter with the following features:
- Line numbering
- Line highlighting
- Diff (+ and -)
- Line focusing
Most importantly, syntax highlighting is done at the time of rendering posts in our back-end.
Therefore, it does not require any additional Javascript or CSS. To change syntax highlighting
settings, go to Console → Settings → Post Content.
Languages
Themes
Adding Code Blocks to Your Post
See Code Block in Editor.
Annotations
Annotations are used for highlighting, focusing, and numbering lines. You can add annotations to the code block in the Editor. Let’s see some examples.
Annotation
Description
h=1Highlights the first line
h=1-5Highlights line 1 to 5
h=1,5,6Highlights line 1, 5, and 6
h=1-4,7Highlights line 1 to 4, and then 7
f=1Focuses number 1 (Works exactly as highlight)
+=12Highlights the 12th line in green (for Diff add)
-=20Highlights the 20th line in red (for Diff remove)
renumber=4:21Number of the 4th line will be changed to 21. The next line will have 22
renumber=6:nullNumber of the 6th line will be hidden
h=1 +=12You can have multiple space separated annotations
numbers=trueEnable line numbers (to override global settings)
numbers=falseDisable line numbers (to override global settings)
Notes
- Colors for syntax comes from our side, but styles like padding, margins, space between lines, and font sizes comes from the theme of your blog.
- Under the hood, we use TextMate grammars for syntax highlighting.