Skip to main content
OwnDocs

File Title

1 min readStableBeginner

Show a file path header above any code block with title="filename", so readers know exactly which file the code belongs to.

Quick Start

Attach a single file title.

lib/auth.ts
TypeScript
export async function createSession() {
  return new SignJWT({}).sign(secret)
}

Adding Options

Combine a title with line highlighting.

lib/theme-variants.ts
TypeScript
export const themes = [
  'emerald',
  'amber',
  'blue',
]

Advanced

Combine a title, line numbers, and word highlighting in one block.

lib/search-index.ts
TypeScript
export function buildSearchIndex(version?: string) {
  return searchIndex
}

Options

title="filename"string

File path shown in the header bar. Optional; no header bar is rendered without it.

Was this page helpful?