MCPcopy Create free account
hub / github.com/GoMudEngine/GoMud / String

Method String

internal/markdown/ast.go:49–86  ·  view source on GitHub ↗
(depth int)

Source from the content-addressed store, hash-verified

47func (n *baseNode) Type() NodeType { return n.nodeType }
48func (n *baseNode) Children() []Node { return n.nodeChildren }
49func (n *baseNode) String(depth int) string {
50 ret := ``
51 for _, c := range n.Children() {
52 if n.Type() == ListNode {
53 ret += c.String(depth - 1)
54 } else {
55 ret += c.String(depth + 1)
56 }
57
58 }
59
60 switch n.Type() {
61 case DocumentNode:
62 return activeFormatter.Document(ret, depth)
63 case HeadingNode:
64 return activeFormatter.Heading(ret, n.level)
65 case ParagraphNode:
66 return activeFormatter.Paragraph(ret, depth)
67 case HorizontalLineNode:
68 return activeFormatter.HorizontalLine(n.content, depth)
69 case HardBreakNode:
70 return activeFormatter.HardBreak(ret, depth)
71 case ListNode:
72 return activeFormatter.List(ret, depth)
73 case ListItemNode:
74 return activeFormatter.ListItem(ret, depth)
75 case TextNode:
76 return activeFormatter.Text(n.content+ret, depth)
77 case StrongNode:
78 return activeFormatter.Strong(ret, depth)
79 case EmphasisNode:
80 return activeFormatter.Emphasis(ret, depth)
81 case SpecialNode:
82 return activeFormatter.Special(ret, n.level)
83 default:
84 return fmt.Sprintf(`[INVALID Node: type=%s depth=%d text=%s]`, n.Type(), depth, n.content+"/"+ret)
85 }
86}

Callers 1

TestParserFunction · 0.95

Calls 14

ChildrenMethod · 0.95
TypeMethod · 0.95
StringMethod · 0.65
DocumentMethod · 0.65
HeadingMethod · 0.65
ParagraphMethod · 0.65
HorizontalLineMethod · 0.65
HardBreakMethod · 0.65
ListMethod · 0.65
ListItemMethod · 0.65
TextMethod · 0.65
StrongMethod · 0.65

Tested by 1

TestParserFunction · 0.76