跳转到内容
GitHub

代码文件

显示本地文件中的代码块.

package.json
{
  "name": "starlight-theme-nova-website",
  "type": "module",
  "version": "0.0.0",
  "private": true,
  "description": "",
  "scripts": {
    "dev": "astro dev",
    "start": "astro dev",
    "build": "astro build",
    "preview": "astro preview",
    "astro": "astro",
    "postinstall": "astro sync"
  },
  "dependencies": {
    "@astrojs/starlight": "^0.35.2",
    "astro": "^5.12.7",
    "sharp": "^0.34.3",
    "starlight-theme-nova": "workspace:*"
  }
}
import { CodeFile } from 'starlight-theme-nova/components'

<CodeFile path="package.json" />

<CodeFile> 组件接受以下属性以及所有其他 <Code> 组件的属性:

必填

类型: string

相对于项目根目录的文件路径.

类型: string

文件标题. 如果未提供, 将使用文件名.

类型: string

文件的代码语言. 如果未提供, 将使用文件扩展名指向的代码语言.