Skip to content

Code Block

Code block configuration is based on Expressive Code, supporting custom themes and code collapsing.

Config File

src/config/expressiveCodeConfig.ts

See also: Mermaid Diagram See also: PlantUML Diagram

Properties

PropertyTypeDefaultDescription
darkThemestring"one-dark-pro"Dark mode code theme
lightThemestring"one-light"Light mode code theme

See Expressive Code Themes for more themes.

Code Collapsing

PropertyTypeDefaultDescription
pluginCollapsible.enablebooleantrueEnable collapsing
pluginCollapsible.lineThresholdnumber15Line count threshold for collapse button
pluginCollapsible.previewLinesnumber8Preview lines when collapsed
pluginCollapsible.defaultCollapsedbooleantrueDefault to collapsed for long blocks
ts
pluginCollapsible: {
  enable: true,
  lineThreshold: 15,
  previewLines: 8,
  defaultCollapsed: true,
},

Language Badge

Displays the language name as text in the top-right corner of the code block.

PropertyTypeDefaultDescription
pluginLanguageBadge.enablebooleanfalseEnable language badge
ts
pluginLanguageBadge: {
  enable: false,
},

Displays a language icon in the bottom-right corner of the code block (powered by ec-lang-logo).

PropertyTypeDefaultDescription
pluginLanguageLogo.enablebooleanfalseEnable language logo
pluginLanguageLogo.color"mono" | "original" | "theme" | "#hex""mono"Logo color mode
pluginLanguageLogo.excludedLangsstring[][]Languages to exclude from showing logos

Color modes:

  • "mono" — Monochrome, auto-adapts to light/dark theme (light: #111, dark: #fff)
  • "original" — Uses each language's original brand color (e.g. JS yellow, TS blue)
  • "theme" — Uses the code block's foreground color
  • "#ff6600" — Custom hex color value
ts
pluginLanguageLogo: {
  enable: false,
  color: "mono",
  excludedLangs: [],
},

WARNING

Restart the Astro dev server after changing this configuration.