Documentation
¶
Overview ¶
Package link resolves wiki links and suggests new ones. Both operate on lines and never touch fenced code, inline code, front matter or any heading.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Changes ¶
Changes maps a document path to its rewritten source. A document that needed no change, or that could not be rewritten, is absent.
type Suggestion ¶
type Suggestion struct {
Path string
Line int
// Text is the matched text, exactly as the document has it.
Text string
// Replacement wraps Text without altering it: prose that is already
// written is not the tool's to edit.
Replacement string
// Col is the byte offset of Text within the line, so that Apply rewrites
// the occurrence that was matched rather than the first one on the line.
Col int
// LineText is the whole line as it was when the suggestion was made, shown
// to the user and checked by Apply before anything is rewritten.
LineText string
}
Suggestion is a proposed link over text that is already written.
func Suggest ¶
func Suggest(r *repo.Repo) []Suggestion
Suggest proposes links over bare identifiers and glossary terms that are not already inside a link or a code span, one per distinct target per document. The document's own identifier, every heading, front matter, code and the glossary's own entries are excluded.