Skip to content

This package contains Markdown helpers and functionality for Lexical using remark-parse.

License

Notifications You must be signed in to change notification settings

themagickoala/lexical-remark

Repository files navigation

Lexical Remark

First attempt at integrating the remark ecosystem with lexical to perform markdown conversion.

Usage

Lexical to Markdown

import { createRemarkExport } from 'lexical-remark';

function exportLexicalToMarkdown(editor: LexicalEditor): string {
  return editor.getEditorState().read(createRemarkExport());
}

Markdown to Lexical

import { createRemarkImport} from 'lexical-remark';

function importMarkdownToLexical(editor: LexicalEditor, markdown: string): void {
  editor.update(
      () => createRemarkImport()(markdown),
      {
        discrete: true,
      },
  );
}

About

This package contains Markdown helpers and functionality for Lexical using remark-parse.

Resources

License

Stars

Watchers

Forks

Packages

No packages published