Hexo Shiki Highlighter Live Demo
Github Repo Link: Efterklang/hexo-shiki-highlight: shiki highlighter for hexo
Basic Config
YAML
_config.yml
shiki: light_theme: catppuccin-latte night_theme: catppuccin-mocha line_number: true highlight_lang: true highlight_title: true highlight_wrap_toggle: true highlight_copy: true is_highlight_shrink: true enable_transformers: true language_aliases: cc: cpp js: javascript py: python exclude_languages: - mermaid code_collapse: enable: true # Enable code collapse feature. Default is true. max_lines: 30 # Maximum lines to show before collapsing. Default is 30. show_lines: 10 # Number of lines to show when collapsed. Default is 10. code_collapse: enable: true # Enable code collapse feature. Default is true. max_lines: 29 # Maximum lines to show before collapsing. Default is 50. show_lines: 10 # Number of lines to show when collapsed. Default is 10.Advance Config: Transformer
Check @shikijs/transformers | Shiki for more details
Hexo Shiki 支挝通过标记为代砝块设置 classes。例如,在注释中添加 [!code--],Shiki 将为该改行代砝对应的 span 元素中添加 diff class
| Type | Mark |
|---|---|
| Diff-Remove | print(A) # [!code--] |
| Diff-Add | print(A) # [!code++] |
| Highlight | print(A) # [!code highlight] |
| … | … |
Diff
TS
console.log("hewwo");console.log("hello");console.log("goodbye");Highlight
TS
console.log("Not highlighted");console.log("Highlighted");console.log("Not highlighted");WordHighlight
TS
const message = "Hello World";console.log(message); // prints Hello WorldFocus
TS
console.log("Not focused");console.log("Focused");console.log("Not focused");ErrorLevel
TS
console.log("No errors or warnings");console.error("Error");console.warn("Warning");Quote
TSconsole.log("This is a quoted code block");
Hexo Shiki Highlighter Live Demo

