koenig/kg-lexical-html-renderer/README.md
Renders a lexical editor state string to a HTML string.
This library differs from Lexical's own lexical-html package in a few ways:
<table> elements in place of modern HTML structurenpm install @tryghost/kg-lexical-html-renderer --save
or
npm install @tryghost/kg-lexical-html-renderer
Basic usage:
const {LexicalHTMLRenderer} = require('@tryghost/kg-lexical-html-renderer');
const renderer = new LexicalHTMLRenderer();
const lexicalState = '{...}';
const html = await renderer.render(lexicalState);
Options can be passed in as the second argument to .render().
const html = await renderer.render(lexicalState, {target: 'email'});
| Option | Values |
|---|---|
target | 'html' (default), 'email' |
This is a mono repository, managed with lerna.
Follow the instructions for the top-level repo.
git clone this repo & cd into it as usualpnpm install from the Ghost monorepo root.pnpm lint run just eslintpnpm test run lint and testsIn order to run local changes, perform the following:
This package is part of the Ghost monorepo workspace — ghost/core resolves
it via workspace: automatically, so local changes are picked up with no
linking. Run pnpm dev in this package for a rebuild-on-change watcher.
kg-default-nodes must also be linked when linking this package as they are codependencies.
Copyright (c) 2013-2026 Ghost Foundation - Released under the MIT license.