Skip to content
FrameworkJavaScript

Inline code: monospace code spans

Wraps selected text in `<code>`. Activated with Cmd/Ctrl+E or by clicking the code button in the inline toolbar. Useful for marking up variable names, function calls, and short code snippets within text.

Import

TypeScript
import { InlineCode } from '@bloklabs/core/tools';

Save Data

TypeScript
// Stored as HTML inside the block's text field.
// "Call <code>getData()</code> to fetch results"
JSON
{
  "type": "paragraph",
  "data": { "text": "Call <code>getData()</code> to fetch results" }
}

Usage Example

TypeScript
import { Blok } from '@bloklabs/core';
import { InlineCode } from '@bloklabs/core/tools';

const editor = new Blok({
  holder: 'editor',
  tools: {
    inlineCode: InlineCode,
  },
});