Skip to main content

Installation

Install @toastwrite/editor in your application to add Markdown editing and preview.

npm

npm install @toastwrite/editor

pnpm

pnpm add @toastwrite/editor

yarn

yarn add @toastwrite/editor

Install a specific version

The current release line starts at 1.0.0-alpha.1:

npm install @toastwrite/editor@1.0.0-alpha.1

Import the stylesheet

The editor ships its own CSS. Import it once in your application entry file:

import '@toastwrite/editor/style.css';

Without this import, the toolbar, preview pane, and syntax highlighting will not be styled correctly.

Module formats

@toastwrite/editor supports both ESM and CommonJS:

// ESM
import { Editor, Viewer } from '@toastwrite/editor';

// CommonJS
const { Editor, Viewer } = require('@toastwrite/editor');

TypeScript types are included in the package (dist/index.d.ts).

Peer dependency: Node.js

The package declares engines.node >= 22 for development and tooling. Browser usage does not require Node at runtime.

Install from source (development)

To try unreleased changes, clone the monorepo and link the workspace package:

git clone https://github.com/toastwrite/editor.git
cd editor
pnpm install
pnpm build

Then in your app, depend on the local path or use pnpm link / workspace protocol as appropriate for your setup.

Next step

See Usage for a minimal integration example with Editor and Viewer.