package text

Import Path
	github.com/yuin/goldmark/text (on go.dev)

Dependency Relation
	imports 5 packages, and imported by 7 packages

Involved Source Files reader.go segment.go
Package-Level Type Names (total 6, in which 4 are exported)
/* sort exporteds by: | */
A BlockReader interface is a reader that is optimized for Blocks. Advance advances the internal pointer. AdvanceAndSetPadding advances the internal pointer and add padding to the reader. AdvanceLine advances the internal pointer to the next line head. Match performs regular expression searching to current line. LineOffset returns a distance from the line head to current position. Match performs regular expression matching to current line. Peek returns a byte at current position without advancing the internal pointer. PeekLine returns the current line without advancing the internal pointer. Position returns current line number and position. PrecendingCharacter returns a character just before current internal pointer. ( T) ReadRune() (r rune, size int, err error) Reset resets current state and sets new segments to the reader. ResetPosition resets positions. SetPadding sets padding to the reader. SetPosition sets current line number and position. SkipSpaces skips blank lines and returns a non-blank line. If it reaches EOF, returns false. SkipSpaces skips space characters and returns a non-blank line. If it reaches EOF, returns false. Source returns a source of the reader. Value returns a value of the given segment. T : Reader T : io.RuneReader func NewBlockReader(source []byte, segments *Segments) BlockReader
A Reader interface provides abstracted method for reading text. Advance advances the internal pointer. AdvanceAndSetPadding advances the internal pointer and add padding to the reader. AdvanceLine advances the internal pointer to the next line head. Match performs regular expression searching to current line. LineOffset returns a distance from the line head to current position. Match performs regular expression matching to current line. Peek returns a byte at current position without advancing the internal pointer. PeekLine returns the current line without advancing the internal pointer. Position returns current line number and position. PrecendingCharacter returns a character just before current internal pointer. ( T) ReadRune() (r rune, size int, err error) ResetPosition resets positions. SetPadding sets padding to the reader. SetPosition sets current line number and position. SkipSpaces skips blank lines and returns a non-blank line. If it reaches EOF, returns false. SkipSpaces skips space characters and returns a non-blank line. If it reaches EOF, returns false. Source returns a source of the reader. Value returns a value of the given segment. BlockReader (interface) T : io.RuneReader func NewReader(source []byte) Reader func github.com/yuin/goldmark/parser.ParseAttributes(reader Reader) (parser.Attributes, bool) func github.com/yuin/goldmark/parser.ASTTransformer.Transform(node *ast.Document, reader Reader, pc parser.Context) func github.com/yuin/goldmark/parser.BlockParser.Close(node ast.Node, reader Reader, pc parser.Context) func github.com/yuin/goldmark/parser.BlockParser.Continue(node ast.Node, reader Reader, pc parser.Context) parser.State func github.com/yuin/goldmark/parser.BlockParser.Open(parent ast.Node, reader Reader, pc parser.Context) (ast.Node, parser.State) func github.com/yuin/goldmark/parser.CloseBlocker.CloseBlock(parent ast.Node, block Reader, pc parser.Context) func github.com/yuin/goldmark/parser.InlineParser.Parse(parent ast.Node, block Reader, pc parser.Context) ast.Node func github.com/yuin/goldmark/parser.ParagraphTransformer.Transform(node *ast.Paragraph, reader Reader, pc parser.Context) func github.com/yuin/goldmark/parser.Parser.Parse(reader Reader, opts ...parser.ParseOption) ast.Node func golang.org/x/pkgsite/internal/postgres.(*ASTTransformer).Transform(node *ast.Document, reader Reader, pc parser.Context)
A Segment struct holds information about source positions. Padding is a padding length of the segment. Start is a start position of the segment. Stop is a stop position of the segment. This value should be excluded. Between returns a segment between this segment and the given segment. ConcatPadding concats the padding to the given slice. IsEmpty returns true if this segment is empty, otherwise false. Len returns a length of the segment. TrimLeftSpace returns a new segment by slicing off all leading space characters including padding. TrimLeftSpaceWidth returns a new segment by slicing off leading space characters until the given width. TrimRightSpace returns a new segment by slicing off all trailing space characters. Value returns a value of the segment. WithStart returns a new Segment with same value except Start. WithStop returns a new Segment with same value except Stop. func NewSegment(start, stop int) Segment func NewSegmentPadding(start, stop, n int) Segment func BlockReader.PeekLine() ([]byte, Segment) func BlockReader.Position() (int, Segment) func BlockReader.SkipBlankLines() (Segment, int, bool) func BlockReader.SkipSpaces() (Segment, int, bool) func Reader.PeekLine() ([]byte, Segment) func Reader.Position() (int, Segment) func Reader.SkipBlankLines() (Segment, int, bool) func Reader.SkipSpaces() (Segment, int, bool) func (*Segment).Between(other Segment) Segment func (*Segment).TrimLeftSpace(buffer []byte) Segment func (*Segment).TrimLeftSpaceWidth(width int, buffer []byte) Segment func (*Segment).TrimRightSpace(buffer []byte) Segment func (*Segment).WithStart(v int) Segment func (*Segment).WithStop(v int) Segment func (*Segments).At(i int) Segment func (*Segments).Sliced(lo, hi int) []Segment func BlockReader.SetPosition(int, Segment) func BlockReader.Value(Segment) []byte func Reader.SetPosition(int, Segment) func Reader.Value(Segment) []byte func (*Segment).Between(other Segment) Segment func (*Segments).Append(t Segment) func (*Segments).AppendAll(t []Segment) func (*Segments).Set(i int, v Segment) func (*Segments).Unshift(v Segment) func github.com/yuin/goldmark/ast.MergeOrAppendTextSegment(parent ast.Node, s Segment) func github.com/yuin/goldmark/ast.MergeOrReplaceTextSegment(parent ast.Node, n ast.Node, s Segment) func github.com/yuin/goldmark/ast.NewRawTextSegment(v Segment) *ast.Text func github.com/yuin/goldmark/ast.NewTextSegment(v Segment) *ast.Text
Segments is a collection of the Segment. Append appends the given segment after the tail of the collection. AppendAll appends all elements of given segments after the tail of the collection. At returns a segment at the given index. Clear delete all element of the collection. Len returns the length of the collection. Set sets the given Segment. SetSliced replace the collection with a subsliced value. Sliced returns a subslice of the collection. Unshift insert the given Segment to head of the collection. func NewSegments() *Segments func github.com/yuin/goldmark/ast.(*BaseBlock).Lines() *Segments func github.com/yuin/goldmark/ast.(*BaseInline).Lines() *Segments func github.com/yuin/goldmark/ast.Node.Lines() *Segments func NewBlockReader(source []byte, segments *Segments) BlockReader func BlockReader.Reset(segment *Segments) func github.com/yuin/goldmark/ast.(*BaseBlock).SetLines(v *Segments) func github.com/yuin/goldmark/ast.(*BaseInline).SetLines(v *Segments) func github.com/yuin/goldmark/ast.Node.SetLines(*Segments)
Package-Level Functions (total 10, in which 5 are exported)
NewBlockReader returns a new BlockReader.
NewReader return a new Reader that can read UTF-8 bytes .
NewSegment return a new Segment.
NewSegmentPadding returns a new Segment with the given padding.
NewSegments return a new Segments.
Package-Level Variables (only one, which is unexported)
Package-Level Constants (total 2, in which 1 are exported)
EOF indicates the end of file.