Skip to main content
The Image extension allows you to insert images into your document. It supports both inline and block-level images, with optional resizing capabilities.

Installation

Usage

Configuration

inline

Controls whether the image node should be inline or block-level.
boolean
default:"false"
When true, images are rendered as inline elements that flow with text.

allowBase64

Controls whether base64 images are allowed.
boolean
default:"false"
Enable this to allow base64-encoded image URLs in the src attribute.

HTMLAttributes

Custom HTML attributes to add to the image element.
Record<string, any>
default:"{}"
Custom HTML attributes that should be added to the rendered HTML tag.

resize

Controls if the image should be resizable.
object | false
default:"false"
Enable image resizing with optional configuration for directions, minimum dimensions, and aspect ratio preservation.

Attributes

The Image node supports the following attributes:
  • src: The image URL (required)
  • alt: Alternative text for the image
  • title: Title text for the image
  • width: Image width in pixels
  • height: Image height in pixels

Commands

setImage

Inserts an image with the specified attributes.

Input Rules

The Image extension supports Markdown-style input rules:
  • Type ![alt text](url) to insert an image
  • Type ![alt text](url "title") to insert an image with a title

Examples

Basic Image

Inline Images

Resizable Images

Allow Base64 Images

Draggable

Images are draggable by default, allowing users to move them within the document.

Source Code

View the source code on GitHub: packages/extension-image/src/image.ts