Search documentation

Type to search.

Navigate · Enter to open · Esc to close

On this page
const ready = true
import CodeBlock from "@chitrank2050/monoline-docs/components/CodeBlock.astro";

<CodeBlock code="const ready = true" language="js" />

Usage

The copy action copies raw source. Overflow is keyboard-scrollable. Without JavaScript the source remains readable and the copy control stays hidden.

Filename and highlighted line

example.js
const ready = true
console.log(ready)
View code
import CodeBlock from "@chitrank2050/monoline-docs/components/CodeBlock.astro";

<CodeBlock
  code={"const ready = true\nconsole.log(ready)"}
  language="js"
  filename="example.js"
  highlights={[2]}
/>

API reference

CodeBlock props
NameTypeDefaultDescription
codestringRequiredRaw source text.
languagestring—Syntax language; unknown languages remain readable.
filenamestring—Optional filename header.
highlightsnumber[][]One-based existing line numbers.

Behavior and accessibility

The copy control copies source without line numbers. Code can be selected manually without JavaScript; long lines remain horizontally scrollable.