koenig/kg-converters/README.md
Converts between the serialized Mobiledoc and Lexical formats.
npm install @tryghost/kg-converters
import {mobiledocToLexical, lexicalToMobiledoc} from '@tryghost/kg-converters';
const lexical = mobiledocToLexical(serializedMobiledoc);
const mobiledoc = lexicalToMobiledoc(serializedLexical);
Both take and return serialized JSON strings. Mobiledoc cards are carried across as Lexical nodes of the same name, so a round trip preserves cards that both formats know about.
This package is part of the Ghost monorepo
and resolves through the pnpm workspace — there is no linking or per-package
install step. Run pnpm setup in the monorepo root, then work in
koenig/kg-converters.
See the Koenig README for the shared build, test and release workflow.
pnpm test:unit runs the unit testspnpm test runs the unit and type tests, including coverage thresholdspnpm lint runs the lint checksCopyright (c) 2013-2026 Ghost Foundation - Released under the MIT license.