Interface: LexicalExportVisitor<LN, UN>
Implement this interface in order to process mdast node(s) into a lexical tree. This is part of the process that converts the editor contents to markdown.
Type parameters
Type parameter |
---|
LN extends LexicalNode |
UN extends Mdast.Nodes |
Methods
join()?
optional
join<T
>(prevNode
,currentNode
):T
Join the current node with the previous node, returning the resulting new node For this to be called by the tree walk, shouldJoin must return true.
Type parameters
Type parameter |
---|
T extends RootContent |
Parameters
Parameter | Type |
---|---|
prevNode | T |
currentNode | T |
Returns
T
shouldJoin()?
optional
shouldJoin(prevNode
,currentNode
):boolean
Return true if the current node should be joined with the previous node. This is necessary due to some inconsistencies between the lexical tree and the mdast tree when it comes to formatting.
Parameters
Parameter | Type |
---|---|
prevNode | RootContent |
currentNode | UN |
Returns
boolean
testLexicalNode()?
optional
testLexicalNode(lexicalNode
):lexicalNode is LN
Return true if the given node is of the type that this visitor can process. You can safely use the node type guard functions (as in $isParagraphNode, $isLinkNode, etc.) here.
Parameters
Parameter | Type |
---|---|
lexicalNode | LexicalNode |
Returns
lexicalNode is LN
visitLexicalNode()?
optional
visitLexicalNode(params
):void
Process the given node and manipulate the mdast tree accordingly.
Parameters
Parameter | Type | Description |
---|---|---|
params | object | - |
params.actions | object | A set of actions that can be used to manipulate the mdast tree. These are "convenience" utilities that avoid the repetitive boilerplate of creating mdast nodes. |
params.actions.addAndStepInto | - | |
params.actions.appendToParent | - | |
params.actions.registerReferredComponent | - | |
params.actions.visitChildren | - | |
params.lexicalNode | LN | The lexical node that is being visited. |
params.mdastParent | Parent | The mdast parent node that the result of the lexical node conversion should be appended to. |
Returns
void
Properties
Property | Type | Description |
---|---|---|
priority? | number | Default 0, optional, sets the priority of the visitor. The higher the number, the earlier it will be called. |