个人博客vluv's space使用的代码高亮插件,基于 Shiki 实现。
![]() |
![]() |
---|
Live Demo: vluv.space/Shiki_Demo/
# 使用 Bun (推荐)
bun i hexo-shiki-highlight
Stable version:
- 2.0.2: Basic support for Shiki Transformers
- 2.1.0: Introduced more granular CSS variables for highlighting, diffs, and UI elements, using the Catppuccin color palette for both light and dark themes.
Add the following configuration to your Hexo _config.yml
:
shiki:
light_theme: 'catppuccin-latte' # Shiki theme for light mode.
dark_theme: 'catppuccin-mocha' # Shiki theme for dark mode.
# --- Display Settings ---
line_number: true # Show line numbers. Default is true.
highlight_wrap_toggle: true # Show wrap toggle button. Default is true.
highlight_lang: true # Show language name. Default is true.
highlight_title: true # Show code block title (if any). Default is true.
highlight_copy: true # Show copy button. Default is true.
# --- Code Block Dimensions ---
is_highlight_shrink: false # Shrink code block by default. Default is false.
# --- Code Collapse Settings ---
code_collapse:
enable: true # Enable code collapse feature. Default is true.
max_lines: 50 # Maximum lines to show before collapsing. Default is 50.
show_lines: 10 # Number of lines to show when collapsed. Default is 10.
smart_scroll: true # Enable smart scroll adjustment when collapsing. Default is true.
# --- Advanced Settings ---
exclude_languages: [] # Languages to exclude from Shiki highlighting.
language_aliases: {} # Language aliases. e.g., { "vue": "html" }
enable_transformers: false # default true
Supported themes & language can be found at Shiki Themes & Shiki Languages.