Typemark Documentation

Code blocks

Show code with syntax highlighting, a filename in the header, and a copy button. Group variants into tabbed code groups.

Uuendatud 19. nov 20262 min lugemist

Code blocks are standard Markdown fences. Typemark highlights them with Shiki and adds a header bar showing the language or filename.

const response = await fetch("https://api.acme.com/users", {
  headers: { Authorization: `Bearer ${apiKey}` },
});
const users = await response.json();
```javascript
const response = await fetch("https://api.acme.com/users", {
  headers: { Authorization: `Bearer ${apiKey}` },
});
const users = await response.json();
```

Code blocks are dark in both light and dark mode.

Languages

Put the language right after the opening backticks. Shiki covers the languages you'd expect, for example:

AreaLanguages
Webjavascript, typescript, jsx, tsx, html, css, scss, json, graphql
Backendpython, ruby, go, java, rust, php, c, cpp, csharp, kotlin, swift
Ops and databash, powershell, dockerfile, yaml, toml, sql, diff
Writingmarkdown, mdx

Short aliases such as js, ts, and sh work too. A fence with no language, or one Shiki doesn't recognise, renders as plain text with no header bar.

Filenames and titles

Write a filename after the language and it replaces the language in the header.

from flask import Flask

app = Flask(__name__)
```python app.py
from flask import Flask

app = Flask(__name__)
```

You can also use title="…". The header shows it in a monospace font, and it wins over a plain label if a fence has both.

production:
  adapter: postgresql
  pool: 5
```yaml title="config/database.yml"
production:
  adapter: postgresql
  pool: 5
```
Fence optionExampleWhat it does
Language```rubySets highlighting. Shown in the header when there's no label or title.
Label```ruby GemfileAny plain words after the language. Shown in the header and used as the tab name in a code group.
title```ruby title="Gemfile"Shown in the header. Used as a code group tab name only when there's no label.

Words like wrap, lines, or a range like {1-3} after the language are ignored, so they never end up in the label.

Code groups

A code group puts several code blocks behind tabs in a single frame. Use it for the same command across package managers, or the same call in different languages.

npm install @acme/sdk
yarn add @acme/sdk
pnpm add @acme/sdk
<CodeGroup>
  ```bash npm
  npm install @acme/sdk
  ```
  ```bash yarn
  yarn add @acme/sdk
  ```
  ```bash pnpm
  pnpm add @acme/sdk
  ```
</CodeGroup>

Each tab is named after its block's label, then its title, then its language. Give every block a label so the tabs read clearly.

const acme = require("@acme/sdk");
const client = new acme.Client({ apiKey: process.env.ACME_KEY });
import os, acme
client = acme.Client(api_key=os.environ["ACME_KEY"])
require "acme"
client = Acme::Client.new(api_key: ENV["ACME_KEY"])
<CodeGroup>
  ```javascript Node.js
  const acme = require("@acme/sdk");
  const client = new acme.Client({ apiKey: process.env.ACME_KEY });
  ```
  ```python Python
  import os, acme
  client = acme.Client(api_key=os.environ["ACME_KEY"])
  ```
  ```ruby Ruby
  require "acme"
  client = Acme::Client.new(api_key: ENV["ACME_KEY"])
  ```
</CodeGroup>

<CodeGroup> takes no props. Put only fenced code blocks inside it. For tabs that mix prose and code, use Tabs.

Copy button

Every code block gets a Copy button when copy_code_button is on in typemark.json. New projects start with it on. A code group has one button that copies the tab that's showing.

{
  "features": {
    "copy_code_button": true
  }
}

You can also switch it in your project settings under Copy code button.

Diagrams

A fence with the language mermaid draws a diagram instead of showing code. See Diagrams.

Inline code

Wrap text in single backticks for inline code: npm run build. In the visual editor, select text and press Cmd+E.

Run `npm run build` before you deploy.

In the visual editor

Type / and pick Code block or Code group. Each block has a language dropdown in its top-right corner. Plain text removes the language.

In a code group, the tabs work like Tabs: add, rename, reorder, or remove them. Renaming a tab writes the new label into that block's fence, so ```bash npm stays readable in source mode too.