这是indexloc提供的服务,不要输入任何密码
Skip to content

feat: add ability to configure syntax highlight #653

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 10, 2025
Merged

feat: add ability to configure syntax highlight #653

merged 1 commit into from
Jun 10, 2025

Conversation

poppingmoon
Copy link
Owner

Added the ability to change colors in the code block.

The following settings can be configured by installing a custom theme.

{
  id: '',
  name: '',
  props: {
    // ...
  },
  codeHighlighter: {
    base: 'rose-pine-dawn', // Theme id from Shiki or Highlight.js.
    overrides: {
      fg: '#111111',        // Default foreground color.
      bg: '#ffffff',        // Background color.
      colorReplacements: {  // A map of color names to new color values.
        '#286983': '#86b300', 
      },
    },
  },
}

For the list of themes available in Shiki and Highlight.js, see https://shiki.style/themes#bundled-themes and https://github.com/highlightjs/highlight.js/tree/main/src/styles.

@poppingmoon poppingmoon merged commit 3b156de into main Jun 10, 2025
14 checks passed
@poppingmoon poppingmoon deleted the shiki branch June 10, 2025 13:22
@poppingmoon poppingmoon mentioned this pull request Jun 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant