Interface: MdastImportVisitor<UN>
Implement this interface to convert certian mdast nodes into lexical nodes.
Type parameters
Type parameter | Description |
---|---|
UN extends Mdast.Nodes | The type of the mdast node that is being visited. |
Methods
visitNode()
visitNode(
params
):void
Parameters
Parameter | Type | Description |
---|---|---|
params | object | - |
params.actions | object | A set of convenience utilities that can be used to add nodes to the lexical tree. |
params.actions.addAndStepInto | - | |
params.actions.addFormatting | - | |
params.actions.getParentFormatting | - | |
params.actions.removeFormatting | - | |
params.actions.visitChildren | - | |
params.descriptors | Descriptors | The descriptors for composite nodes (jsx, directives, code blocks). |
params.lexicalParent | LexicalNode | The parent lexical node to which the results of the processing should be added. |
params.mdastNode | UN | The node that is currently being visited. |
params.mdastParent | null | Parent | The MDAST parent of the node that is currently being visited. |
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. |
testNode | string | (mdastNode , descriptors ) => boolean | The test function that determines if this visitor should be used for the given node. As a convenience, you can also pass a string here, which will be compared to the node's type.Paramthe registered descriptors for composite nodes (jsx, directives, code blocks). |