Module: @lexical/markdown
Type Aliases
ElementTransformer
Ƭ ElementTransformer: Object
Type declaration
Name | Type | Description |
---|---|---|
dependencies | Klass <LexicalNode >[] | - |
export | (node : LexicalNode , traverseChildren : (node : ElementNode ) => string ) => string | null | - |
regExp | RegExp | - |
replace | (parentNode : ElementNode , children : LexicalNode [], match : string [], isImport : boolean ) => boolean | void | - |
type | "element" | - |
Defined in
packages/lexical-markdown/src/MarkdownTransformers.ts:47
MultilineElementTransformer
Ƭ MultilineElementTransformer: Object
Type declaration
Name | Type | Description |
---|---|---|
dependencies | Klass <LexicalNode >[] | - |
export? | (node : LexicalNode , traverseChildren : (node : ElementNode ) => string ) => string | null | - |
regExpEnd? | RegExp | { optional? : true ; regExp : RegExp } | This regex determines when to stop matching. Anything in between regExpStart and regExpEnd will be matched |
regExpStart | RegExp | This regex determines when to start matching |
replace | (rootNode : ElementNode , children : LexicalNode [] | null , startMatch : string [], endMatch : string [] | null , linesInBetween : string [] | null , isImport : boolean ) => boolean | void | - |
type | "multiline-element" | - |
Defined in
packages/lexical-markdown/src/MarkdownTransformers.ts:77
TextFormatTransformer
Ƭ TextFormatTransformer: Readonly
<{ format
: ReadonlyArray
<TextFormatType
> ; intraword?
: boolean
; tag
: string
; type
: "text-format"
}>
Defined in
packages/lexical-markdown/src/MarkdownTransformers.ts:133
TextMatchTransformer
Ƭ TextMatchTransformer: Readonly
<{ dependencies
: Klass
<LexicalNode
>[] ; export
: (node
: LexicalNode
, exportChildren
: (node
: ElementNode
) => string
, exportFormat
: (node
: TextNode
, textContent
: string
) => string
) => string
| null
; importRegExp
: RegExp
; regExp
: RegExp
; replace
: (node
: TextNode
, match
: RegExpMatchArray
) => void
; trigger
: string
; type
: "text-match"
}>
Defined in
packages/lexical-markdown/src/MarkdownTransformers.ts:140
Transformer
Ƭ Transformer: ElementTransformer
| MultilineElementTransformer
| TextFormatTransformer
| TextMatchTransformer
Defined in
packages/lexical-markdown/src/MarkdownTransformers.ts:41
Variables
BOLD_ITALIC_STAR
• Const
BOLD_ITALIC_STAR: TextFormatTransformer
Defined in
packages/lexical-markdown/src/MarkdownTransformers.ts:451
BOLD_ITALIC_UNDERSCORE
• Const
BOLD_ITALIC_UNDERSCORE: TextFormatTransformer
Defined in
packages/lexical-markdown/src/MarkdownTransformers.ts:457
BOLD_STAR
• Const
BOLD_STAR: TextFormatTransformer
Defined in
packages/lexical-markdown/src/MarkdownTransformers.ts:464
BOLD_UNDERSCORE
• Const
BOLD_UNDERSCORE: TextFormatTransformer
Defined in
packages/lexical-markdown/src/MarkdownTransformers.ts:470
CHECK_LIST
• Const
CHECK_LIST: ElementTransformer
Defined in
packages/lexical-markdown/src/MarkdownTransformers.ts:419
CODE
• Const
CODE: MultilineElementTransformer
Defined in
packages/lexical-markdown/src/MarkdownTransformers.ts:326
ELEMENT_TRANSFORMERS
• Const
ELEMENT_TRANSFORMERS: ElementTransformer
[]
Defined in
packages/lexical-markdown/src/index.ts:41
HEADING
• Const
HEADING: ElementTransformer
Defined in
packages/lexical-markdown/src/MarkdownTransformers.ts:272
HIGHLIGHT
• Const
HIGHLIGHT: TextFormatTransformer
Defined in
packages/lexical-markdown/src/MarkdownTransformers.ts:445
INLINE_CODE
• Const
INLINE_CODE: TextFormatTransformer
Defined in
packages/lexical-markdown/src/MarkdownTransformers.ts:439
ITALIC_STAR
• Const
ITALIC_STAR: TextFormatTransformer
Defined in
packages/lexical-markdown/src/MarkdownTransformers.ts:483
ITALIC_UNDERSCORE
• Const
ITALIC_UNDERSCORE: TextFormatTransformer
Defined in
packages/lexical-markdown/src/MarkdownTransformers.ts:489
LINK
• Const
LINK: TextMatchTransformer
Defined in
packages/lexical-markdown/src/MarkdownTransformers.ts:500
MULTILINE_ELEMENT_TRANSFORMERS
• Const
MULTILINE_ELEMENT_TRANSFORMERS: MultilineElementTransformer
[]
Defined in
packages/lexical-markdown/src/index.ts:48
ORDERED_LIST
• Const
ORDERED_LIST: ElementTransformer
Defined in
packages/lexical-markdown/src/MarkdownTransformers.ts:429
QUOTE
• Const
QUOTE: ElementTransformer
Defined in
packages/lexical-markdown/src/MarkdownTransformers.ts:289
STRIKETHROUGH
• Const
STRIKETHROUGH: TextFormatTransformer
Defined in
packages/lexical-markdown/src/MarkdownTransformers.ts:477
TEXT_FORMAT_TRANSFORMERS
• Const
TEXT_FORMAT_TRANSFORMERS: TextFormatTransformer
[]
Defined in
packages/lexical-markdown/src/index.ts:56
TEXT_MATCH_TRANSFORMERS
• Const
TEXT_MATCH_TRANSFORMERS: TextMatchTransformer
[]
Defined in
packages/lexical-markdown/src/index.ts:68
TRANSFORMERS
• Const
TRANSFORMERS: Transformer
[]
Defined in
packages/lexical-markdown/src/index.ts:70
UNORDERED_LIST
• Const
UNORDERED_LIST: ElementTransformer
Defined in
packages/lexical-markdown/src/MarkdownTransformers.ts:409
Functions
$convertFromMarkdownString
▸ $convertFromMarkdownString(markdown
, transformers?
, node?
, shouldPreserveNewLines?
, shouldNormalizeMarkdown?
): void
Renders markdown from a string. The selection is moved to the start after the operation.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
markdown | string | undefined | - |
transformers | Transformer [] | TRANSFORMERS | - |
node? | ElementNode | undefined | - |
shouldPreserveNewLines? | boolean | false | By setting this to true, new lines will be preserved between conversions |
shouldNormalizeMarkdown? | boolean | true | By setting this to true, adjacent non empty lines will be merged according to commonmark spec: https://spec.commonmark.org/0.24/#example-177 |
Returns
void
Defined in
packages/lexical-markdown/src/index.ts:83
$convertToMarkdownString
▸ $convertToMarkdownString(transformers?
, node?
, shouldPreserveNewLines?
): string
Renders string from markdown. The selection is moved to the start after the operation.
Parameters
Name | Type | Default value |
---|---|---|
transformers | Transformer [] | TRANSFORMERS |
node? | ElementNode | undefined |
shouldPreserveNewLines | boolean | false |
Returns
string
Defined in
packages/lexical-markdown/src/index.ts:104
registerMarkdownShortcuts
▸ registerMarkdownShortcuts(editor
, transformers?
): () => void
Parameters
Name | Type | Default value |
---|---|---|
editor | LexicalEditor | undefined |
transformers | Transformer [] | TRANSFORMERS |
Returns
fn
▸ (): void
Returns
void