2024-04-05 00:15:46 +08:00

76 lines
1.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: 介绍
author: pengzhanbo
icon: ic:outline-code
createTime: 2024/04/04 10:35:45
permalink: /guide/code/intro/
---
## 概述
主题 使用 [Shiki](https://github.com/shikijs/shiki) 在 Markdown 代码块实现语法高亮。
## 语言
[Shiki](https://github.com/shikijs/shiki) 支持 超过 190+ 种语言,
你可以在 [languages](https://shiki.style/languages) 查看所有支持的语言列表。
你可以通过以下语法为你使用的 语言所编写的代码 实现高亮效果:
````md
```[lang]
```
````
其中,`[lang]` 为你使用的语言。
示例:
````md
```js
const a = 1
console.log(a)
```
````
```js
const a = 1
console.log(a)
```
## 高亮主题
[Shiki](https://github.com/shikijs/shiki) 支持 超过 40+ 种高亮主题。
你可以在 [Themes](https://shiki.style/themes) 找到所有支持的主题列表,根据个人的喜欢自定义
高亮主题。
Theme Plume 默认为 代码块使用的主题配置:
```ts
export default defineUserConfig({
theme: plumeTheme({
plugins: {
shiki: {
theme: { light: 'vitesse-light', dark: 'vitesse-dark' }, // [!code highlight]
}
}
})
})
```
默认配置支持在 亮色/暗色 模式分别使用 `vitesse-light`/`vitesse-dark` 主题。
## 更多支持
得益于 [Shiki](https://github.com/shikijs/shiki) 的强大能力Theme Plume 还为 代码块
提供了 更多的 [特性支持](/guide/code/features/),它们让 代码块具备更强的表达能力。
同时,为了方便 更好的 完成 代码演示Theme Plume 还提供了嵌入 [CodePen](/guide/code/code-pen/)
[Js Fiddle](/guide/code/jsfiddle/)[Code Sandbox](/guide/code/code-sandbox/)
[Replit](/guide/code/replit/) 的语法支持,你可以很方便的嵌入代码演示。
## 示例
<!-- @include: ../../snippet/code-block.snippet.md -->