Skip to main content

Module highlight

Module highlight 

Source
Expand description

Syntax highlighting for fenced code blocks.

This module provides syntect-based syntax highlighting, theme management, and terminal background detection. It is gated behind the syntax-highlight feature (enabled by default).

§Built-in themes

Seven themes are bundled with the crate:

  • base16-eighties.dark (default for dark mode)
  • base16-ocean.dark
  • base16-mocha.dark
  • base16-ocean.light
  • InspiredGitHub
  • Solarized (dark)
  • Solarized (light) (default for light mode)

Enums§

ThemeMode
Controls which syntax highlighting theme is applied to code blocks.

Functions§

highlight_lines
Highlight source code lines using syntect.
list_themes
Lists the names of all available syntax highlighting themes.
syntax_set
Returns the global syntax set (lazy-initialized).
themes
Returns the global theme set (lazy-initialized).