summaryrefslogtreecommitdiff
path: root/vendor/github.com/yuin/goldmark/ast/ast.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/yuin/goldmark/ast/ast.go')
-rw-r--r--vendor/github.com/yuin/goldmark/ast/ast.go15
1 files changed, 14 insertions, 1 deletions
diff --git a/vendor/github.com/yuin/goldmark/ast/ast.go b/vendor/github.com/yuin/goldmark/ast/ast.go
index 67bb0da56..36ba606f7 100644
--- a/vendor/github.com/yuin/goldmark/ast/ast.go
+++ b/vendor/github.com/yuin/goldmark/ast/ast.go
@@ -123,6 +123,12 @@ 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.
+ //
+ // Deprecated: Use other properties of the node to get the text value(i.e. Pragraph.Lines, Text.Value).
Text(source []byte) []byte
// HasBlankPreviousLines returns true if the row before this node is blank,
@@ -374,11 +380,18 @@ func (n *BaseNode) OwnerDocument() *Document {
return nil
}
-// Text implements Node.Text .
+// Text implements Node.Text .
+//
+// Deprecated: Use other properties of the node to get the text value(i.e. Pragraph.Lines, Text.Value).
func (n *BaseNode) Text(source []byte) []byte {
var buf bytes.Buffer
for c := n.firstChild; c != nil; c = c.NextSibling() {
buf.Write(c.Text(source))
+ if sb, ok := c.(interface {
+ SoftLineBreak() bool
+ }); ok && sb.SoftLineBreak() {
+ buf.WriteByte('\n')
+ }
}
return buf.Bytes()
}