First attempt at integrating the remark ecosystem with lexical to perform markdown conversion.
import { createRemarkExport } from 'lexical-remark';
function exportLexicalToMarkdown(editor: LexicalEditor): string {
return editor.getEditorState().read(createRemarkExport());
}
import { createRemarkImport} from 'lexical-remark';
function importMarkdownToLexical(editor: LexicalEditor, markdown: string): void {
editor.update(
() => createRemarkImport()(markdown),
{
discrete: true,
},
);
}