Documentation ¶
Overview ¶
Example ¶
package main import ( "fmt" "github.com/meyermarcel/annot" ) func main() { fmt.Println("The greatest enemy of knowledge is not ignorance, it is the illusion of knowledge.") fmt.Println(annot.String( &annot.Annot{Col: 1, Lines: []string{"article"}}, &annot.Annot{Col: 4, ColEnd: 11, Lines: []string{"adjective"}}, &annot.Annot{Col: 22, ColEnd: 30, Lines: []string{ "facts, information, and skills acquired", "through experience or education;", "the theoretical or practical understanding", "of a subject.", }}, &annot.Annot{Col: 48, Lines: []string{"comma"}}, )) }
Output: The greatest enemy of knowledge is not ignorance, it is the illusion of knowledge. ↑ └──┬───┘ └───┬───┘ ↑ │ └─ adjective │ └─ comma │ │ └─ article └─ facts, information, and skills acquired through experience or education; the theoretical or practical understanding of a subject.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Annot ¶
type Annot struct { // Col is the position of the arrowhead of the annotation. // E.g. 0 draws an arrow to the first character in a line. Col int // ColEnd needs to be higher than Col. If ColEnd is set a // range is annotated. ColEnd int // Lines is the text of the annotation represented in one or more lines. Lines []string // contains filtered or unexported fields }
Annot annotates information with a text (represented in Lines) at a position in a line (Col).
func (*Annot) AppendLines ¶
AppendLines adds initial or appends additional lines to an annotation.
type ColExceedsColEndError ¶ added in v0.4.0
type ColExceedsColEndError struct {
// contains filtered or unexported fields
}
func (*ColExceedsColEndError) Error ¶ added in v0.4.0
func (e *ColExceedsColEndError) Error() string
func (*ColExceedsColEndError) Is ¶ added in v0.4.0
func (e *ColExceedsColEndError) Is(target error) bool
type OverlapError ¶ added in v0.4.0
type OverlapError struct {
// contains filtered or unexported fields
}
func (*OverlapError) Error ¶ added in v0.4.0
func (e *OverlapError) Error() string
func (*OverlapError) Is ¶ added in v0.4.0
func (e *OverlapError) Is(target error) bool
Click to show internal directories.
Click to hide internal directories.