Skip to content
Discussion options

You must be logged in to vote

Ah, I see now. I should create a new AST node that consumes the matched marker but does nothing else:

// ContentMarkerAST is an empty AST node used to consume the marker characters
type ContentMarkerAST struct {
	ast.BaseInline
	Segment text.Segment
}

// Dump implements the ast.Dumper interface
func (n *ContentMarkerAST) Dump(source []byte, level int) {
	ast.DumpHelper(n, source, level, nil, nil)
}

var KindContentMarker = ast.NewNodeKind("ContentMarkerAST")

// Kind returns the node type
func (n *ContentMarkerAST) Kind() ast.NodeKind {
	return KindContentMarker
}

...

	marker := &ContentMarkerAST{
		Segment: text.NewSegment(segment.Start, segment.Start+numEnd+1),
	}
	return marker

...

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Tryanks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant