From 65dcf6cd0aadc37c2e4ddf73ff5dd4335760ed0a Mon Sep 17 00:00:00 2001 From: yuin Date: Tue, 15 Oct 2024 19:22:00 +0900 Subject: [PATCH] Add warning to Node.Text GoDoc --- ast/ast.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ast/ast.go b/ast/ast.go index 7edd63b..8bc38e6 100644 --- a/ast/ast.go +++ b/ast/ast.go @@ -123,6 +123,10 @@ type Node interface { Dump(source []byte, level int) // Text returns text values of this node. + // This method is valid only for some inline nodes. + // If this node is a block node, Text returns a text value as reasonable as possible. + // Notice that there are no 'correct' text values for the block nodes. + // Result for the block nodes may be different from your expectation. Text(source []byte) []byte // HasBlankPreviousLines returns true if the row before this node is blank,