Socket
Socket
Sign inDemoInstall

@lexical/markdown

Package Overview
Dependencies
Maintainers
0
Versions
150
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.


Version published
Weekly downloads
527K
increased by9.4%
Maintainers
0
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

FAQs

Package last updated on 01 Jul 2024

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc