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
// A mark on a run of the block's text field:
// { "text": "getData()", "marks": { "code": true } }JSON
{
"type": "paragraph",
"data": {
"text": [
{ "text": "Call " },
{ "text": "getData()", "marks": { "code": true } },
{ "text": " to fetch results" }
]
}
}Usage Example
TypeScript
import { Blok } from '@bloklabs/core';
import { InlineCode, Paragraph } from '@bloklabs/core/tools';
const editor = new Blok({
holder: 'editor',
tools: {
// Paragraph is the default block and is not bundled with the core —
// without it the editor starts with an "unsupported block" stub.
paragraph: Paragraph,
inlineCode: InlineCode,
},
});