Skip to content

getSelectionAsMarkdown

reference
1 min readUpdated

Kind: Function

Source: atloria-monorepo/packages/editor/src/utils/lexicalHelpers.ts

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. Converts selected nodes to markdown by recursively processing them and preserving formatting. Note: Selects entire nodes, not partial selections within nodes.

Signature

ts
function getSelectionAsMarkdown(editor: LexicalEditor, _exportParams: Omit<ExportMarkdownFromLexicalOptions, 'root'>): string

Parameters

NameType
editorLexicalEditor
_exportParamsOmit<ExportMarkdownFromLexicalOptions, 'root'>

Returns: string

Was this page helpful?

Download as PDF