# Markdown Code Block Fence renderer for the markdown item: the shadcn/ui code block with a language title and copy, highlighted with shiki. A fence that streams is tokenized line by line, so finished lines are never re-highlighted. ## Installation ```bash npx shadcn@latest add litingyes/blocove/markdown-code-block ``` > Typography requires [shadcn/typeset](https://ui.shadcn.com/docs/typeset). Copy `typeset.css` next to your main stylesheet, import it after Tailwind and add the `.typeset-docs` preset. This example also uses: `markdown`. ```bash npx shadcn@latest add litingyes/blocove/markdown ``` Fences render inside the shadcn/ui code block: a card with the language in the header and a copy action, so an answer looks like the docs code panels instead of a bare `
`. Copy takes the current source, including while the fence is still streaming. The card is a typeset component, so typeset supplies the block spacing and the old `pre > code` rules no longer apply to fences. Tokens still arrive line by line: finished lines keep their tokens and only the open line is tokenized again, starting from the grammar state of the line before it, so the cost of a token is one line, not the block. The shipped languages are bash, css, diff, html, javascript, json, jsx, markdown, python, sql, tsx, typescript and yaml, with the usual aliases; anything else renders as plain text.

## API Reference

### MarkdownCodeBlock

The fence renderer. The shell passes `language`, `code`, `streaming` and `complete`; register it through the shell's `components` map. The card root carries `data-language` and the header shows the language; the copy action copies the current source, including while the fence streams. Typeset supplies the block spacing, and the code block itself styles the fence.

Extends `MarkdownCodeProps`.

| Prop | Type | Default |
| --- | --- | --- |
| `language` | `string` | `Required` |
| `code` | `string` | `Required` |
| `streaming` | `boolean` | - |
| `complete` | `boolean` | - |
| `className` | `string` | - |

## Registry dependencies

- `litingyes/blocove/markdown-parse`
- `code-block`

Namespace: `npx shadcn@latest add @blocove/markdown-code-block`