@@ -19,14 +19,6 @@ func (b *BaseBlock) Type() NodeType {
1919 return TypeBlock
2020}
2121
22- // Pos implements Node.Pos.
23- func (b * BaseBlock ) Pos () int {
24- if b .lines .Len () == 0 {
25- return - 1
26- }
27- return b .lines .At (0 ).Start
28- }
29-
3022// IsRaw implements Node.IsRaw.
3123func (b * BaseBlock ) IsRaw () bool {
3224 return false
@@ -132,6 +124,14 @@ func (n *TextBlock) Dump(source []byte, level int) {
132124 DumpHelper (n , source , level , nil , nil )
133125}
134126
127+ // Pos implements Node.Pos.
128+ func (n * TextBlock ) Pos () int {
129+ if n .lines .Len () == 0 {
130+ return - 1
131+ }
132+ return n .lines .At (0 ).Start
133+ }
134+
135135// KindTextBlock is a NodeKind of the TextBlock node.
136136var KindTextBlock = NewNodeKind ("TextBlock" )
137137
@@ -164,6 +164,14 @@ func (n *Paragraph) Dump(source []byte, level int) {
164164 DumpHelper (n , source , level , nil , nil )
165165}
166166
167+ // Pos implements Node.Pos.
168+ func (n * Paragraph ) Pos () int {
169+ if n .lines .Len () == 0 {
170+ return - 1
171+ }
172+ return n .lines .At (0 ).Start
173+ }
174+
167175// KindParagraph is a NodeKind of the Paragraph node.
168176var KindParagraph = NewNodeKind ("Paragraph" )
169177
@@ -512,6 +520,7 @@ func (n *HTMLBlock) Dump(source []byte, level int) {
512520 indent := strings .Repeat (" " , level )
513521 fmt .Printf ("%s%s {\n " , indent , "HTMLBlock" )
514522 indent2 := strings .Repeat (" " , level + 1 )
523+ fmt .Printf ("%sPos: %d\n " , indent2 , n .Pos ())
515524 fmt .Printf ("%sRawText: \" " , indent2 )
516525 for i := range n .Lines ().Len () {
517526 s := n .Lines ().At (i )
@@ -576,6 +585,14 @@ func (l *LinkReferenceDefinition) IsRaw() bool {
576585 return true
577586}
578587
588+ // Pos implements Node.Pos.
589+ func (l * LinkReferenceDefinition ) Pos () int {
590+ if l .lines .Len () == 0 {
591+ return - 1
592+ }
593+ return l .lines .At (0 ).Start
594+ }
595+
579596// Dump implements Node.Dump.
580597func (l * LinkReferenceDefinition ) Dump (source []byte , level int ) {
581598 m := map [string ]string {
0 commit comments