Skip to content

Code File

Displays a code block from a local file.

{
  "name": "starlight-theme-nova-website",
  "type": "module",
  "version": "0.0.0",
  "private": true,
  "description": "The website for the Starlight Nova theme",
  "scripts": {
    "dev": "astro dev",
    "start": "astro dev",
    "build": "astro build",
    "preview": "astro preview",
    "astro": "astro",
    "postinstall": "astro sync",
    "test": "playwright test --max-failures 3",
    "test:update": "playwright test --update-snapshots"
  },
  "dependencies": {
    "@astrojs/starlight": "^0.37.7",
    "astro": "^5.18.0",
    "sharp": "^0.34.5",
    "starlight-theme-nova": "*"
  },
  "devDependencies": {
    "@playwright/test": "^1.58.2",
    "@sindresorhus/slugify": "^3.0.0",
    "astro-minify-html-swc": "^0.1.10"
  }
}
import { CodeFile } from 'starlight-theme-nova/components'

<CodeFile path="package.json" />

The <CodeFile> component accepts the following props, as well as all other <Code> component props:

required

type: string

The file path relative to the project root.

type: string

The title of the file. If not provided, the file name will be used.

type: string

The language of the file. If not provided, the file extension will be used.