🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

@lexical/markdown

Package Overview
Dependencies
Maintainers
5
Versions
346
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lexical/markdown

This package contains Markdown helpers and functionality for Lexical.

0.31.2
latest
Source
npm
Version published
Weekly downloads
847K
4.82%
Maintainers
5
Weekly downloads
 
Created

What is @lexical/markdown?

@lexical/markdown is a package that provides utilities for converting between Lexical editor states and Markdown. It allows you to parse Markdown into Lexical nodes and serialize Lexical nodes back into Markdown.

What are @lexical/markdown's main functionalities?

Parsing Markdown to Lexical Nodes

This feature allows you to convert a Markdown string into Lexical nodes, which can then be used within a Lexical editor.

const { $convertFromMarkdownString } = require('@lexical/markdown');
const markdownString = '# Hello World';
const lexicalNodes = $convertFromMarkdownString(markdownString);

Serializing Lexical Nodes to Markdown

This feature allows you to convert Lexical nodes back into a Markdown string, making it easy to save or share the content in Markdown format.

const { $convertToMarkdownString } = require('@lexical/markdown');
const lexicalNodes = [/* some Lexical nodes */];
const markdownString = $convertToMarkdownString(lexicalNodes);

Custom Markdown Parsing Rules

This feature allows you to define custom parsing rules for Markdown, giving you flexibility in how Markdown is interpreted and converted into Lexical nodes.

const { $convertFromMarkdownString, $createMarkdownParser } = require('@lexical/markdown');
const customRules = [/* custom parsing rules */];
const parser = $createMarkdownParser(customRules);
const markdownString = '# Custom Rule Example';
const lexicalNodes = parser.parse(markdownString);

Other packages similar to @lexical/markdown

Keywords

lexical

FAQs

Package last updated on 20 May 2025

Did you know?

Socket

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