Socket
Socket
Sign inDemoInstall

@tryghost/kg-lexical-html-renderer

Package Overview
Dependencies
150
Maintainers
29
Versions
148
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @tryghost/kg-lexical-html-renderer

Renders a lexical editor state string to a HTML string.


Version published
Weekly downloads
3K
increased by2.52%
Maintainers
29
Created
Weekly downloads
 

Readme

Source

Koenig Lexical Html Renderer

Renders a lexical editor state string to a HTML string.

This library differs from Lexical's own lexical-html package in a few ways:

  1. it's output target is not an editor but rendered web pages or emails which means the handling of nodes (especially custom DecoratorNodes) will differ to the node's built-in editor-focused rendering
  2. render output will vary based on supplied options and targets, e.g. when rendering for email the output may use <table> elements in place of modern HTML structure
  3. it's primary usage environment is server-side

Install

npm install @tryghost/kg-lexical-html-renderer --save

or

yarn add @tryghost/kg-lexical-html-renderer

Usage

Basic usage:

const LexicalHTMLRenderer = require('@tryghost/kg-lexical-html-renderer');
const renderer = new Renderer();

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'});
OptionValues
target'html' (default), 'email'

Develop

This is a mono repository, managed with lerna.

Follow the instructions for the top-level repo.

  1. git clone this repo & cd into it as usual
  2. Run yarn to install top-level dependencies.

Test

  • yarn lint run just eslint
  • yarn test run lint and tests

Running in Ghost Admin

In order to run local changes, perform the following:

  1. Run yarn link within kg-lexical-html-renderer
  2. Run yarn link @tryghost/kg-lexical-html-renderer within ghost/core

kg-default-nodes must also be linked when linking this package as they are codependencies.

Copyright (c) 2013-2023 Ghost Foundation - Released under the MIT license.

FAQs

Last updated on 18 Apr 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc