Function: getSelectionAsMarkdown()

getSelectionAsMarkdown(editor, exportParams): string

Gets the markdown representation of the current selection in the Lexical editor. Returns an empty string if there is no selection or if the selection is collapsed. Uses the same visitors and serialization options as the editor's full markdown export.

Parameters

ParameterType
editorLexicalEditor
exportParamsOmit<ExportMarkdownFromLexicalOptions, "root">

Returns

string