The Code extension adds support for inline code formatting with keyboard shortcuts, input rules, and commands.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/prosekit/prosekit/llms.txt
Use this file to discover all available pages before exploring further.
Installation
Usage
Add the code extension to your editor:API Reference
defineCode()
Defines the complete inline code extension including:- Mark specification for
<code>HTML tag - Commands for toggling code formatting
- Keyboard shortcuts
- Input rules for Markdown-style syntax
CodeExtension
Commands
toggleCode
Toggles inline code formatting on the current selection or at the cursor position.Keyboard Shortcuts
| Shortcut | Action |
|---|---|
Mod-e | Toggle inline code formatting |
Mod is Cmd on macOS and Ctrl on Windows/Linux.Input Rules
The extension supports Markdown-style input rules:- Type
`text`to create inline code - The backticks will be automatically removed and the text will be formatted as code
HTML Output
Inline code is rendered as<code> elements:
Parsing
The extension recognizes<code> tags when parsing content.
Code Mark Behavior
The code mark is defined withcode: true, which means:
- It excludes other marks by default
- It’s treated as a code-like mark in the schema
- Other formatting marks typically won’t apply inside code
Advanced Configuration
If you need more control, you can use the individual components:Difference from Code Block
This extension is for inline code (likevariable in a sentence). For multi-line code blocks, see the Code Block extension.