Code blocks
Fence code with three backticks and add a language identifier for highlighting:
```ts
export function greet(name: string) {
return `Hello, ${name}`;
}
```Use single backticks for inline code.
Editor actions
Place the cursor inside a fence or select code to access:
- Explain Code, Add Comments, Refactor, and Generate Tests
- Prettify Code, Convert Code, and Identify Language
- Gistify to publish a code block as a GitHub Gist
- Screenshot to create a shareable code image

AI actions and non-AI utilities are identified in the action menu. See AI writing for their behavior.
mdedit.ai supports the language identifiers supplied by its syntax highlighter. Prefer common short names such as js, ts, tsx, python, bash, json, yaml, sql, go, rust, java, and css.
Long lines can scroll or wrap according to preview settings. Indented code blocks render, but fenced blocks are clearer and carry a language identifier.