This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Koenig is Ghost's editor based on the Lexical framework. This is a Lerna-managed monorepo containing multiple packages for Ghost's content editing ecosystem.
This project uses Yarn for package management.
yarn setup # Initial setup: install deps, link packages, build all
yarn dev # Run koenig-lexical in standalone mode (localhost:5173)
yarn test # Run tests across all packages (delegates to lerna run test)
yarn lint # Run ESLint across all packages
yarn ship # Publish packages to npm (Ghost team only)yarn workspace @tryghost/koenig-lexical dev # Same as yarn devyarn test:unit # Vitest unit tests
yarn test:e2e # Playwright e2e tests
yarn test:e2e:headed # E2E tests with browser UI (for debugging)- koenig-lexical: Main editor package - React components built on Lexical
- kg-lexical-html-renderer: Converts serialized Lexical to HTML
- kg-html-to-lexical: Converts HTML to serialized Lexical
- kg-default-nodes: Lexical node definitions for content types
- kg-default-transforms: Content transformation utilities
- kg-converters: Format conversion between Lexical/Mobiledoc
- kg-mobiledoc-html-renderer: Mobiledoc to HTML conversion
- html-to-mobiledoc: HTML to Mobiledoc conversion
- kg-default-cards: Mobiledoc card definitions
- kg-parser-plugins: Mobiledoc content parsing plugins
- kg-simplemde: SimpleMDE markdown editor integration
- kg-utils: Shared utilities
- kg-clean-basic-html: HTML sanitization
- kg-unsplash-selector: Unsplash image selection component
Run yarn dev to develop the editor independently at http://localhost:5173
- Uses Tailwind CSS classes where possible
- All styles scoped under
.koenig-lexicalclass - SVGs imported as React components
- PostCSS nesting for style organization
- Unit tests: Vitest framework in
test/unit/ - E2E tests: Playwright in
test/e2e/ - Demo app built before tests run
- Use
-tflag to filter tests by keyword
Packages have complex interdependencies. Key relationships:
- koenig-lexical depends on kg-default-nodes, kg-lexical-html-renderer, kg-html-to-lexical
- Transformation packages depend on kg-utils
VITE_KLIPY_API_KEY: Required for Gif card functionality (preferred provider)VITE_TENOR_API_KEY: Required for Gif card functionality (fallback when Klipy key is not set)VITE_SENTRY_*: Error tracking configuration
- Bookmark/Embed cards require CORS enabled for development
- Uses Lerna for monorepo management
- ESLint configuration via eslint-plugin-ghost