Documentation
¶
Overview ¶
Package fixer provides functionality to automatically fix redirect URLs in markdown files.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DetailedSummary ¶
DetailedSummary returns a detailed summary showing each change.
Types ¶
type FileChanges ¶
type FileChanges struct {
FilePath string
Fixes []Fix
TotalFixes int // Total number of replacements (accounting for occurrences)
}
FileChanges groups all fixes for a single file.
type Fix ¶
type Fix struct {
FilePath string // File containing the URL
OldURL string // Original URL (redirect source)
NewURL string // Final URL (redirect destination)
RefName string // Reference name if IsRefDef (e.g., "myref" in [myref]: url)
Line int // Line number where the URL appears
Occurrences int // How many times this exact URL appears in the file
LinkType parser.LinkType
RefUsages int // How many places use this reference
IsRefDef bool // Is this a reference definition line?
}
Fix represents a single URL replacement to be made.
type FixResult ¶
type FixResult struct {
Error error
FilePath string
ChangedURLs []URLChange
Applied int
Skipped int
}
FixResult represents the outcome of applying fixes to a file.
type Fixer ¶
type Fixer struct {
// contains filtered or unexported fields
}
Fixer handles URL replacement in markdown files.
func (*Fixer) ApplyAll ¶
func (f *Fixer) ApplyAll(changes []FileChanges) []FixResult
ApplyAll applies fixes to all files and returns results.
func (*Fixer) ApplyToFile ¶
func (*Fixer) ApplyToFile(fc FileChanges) (*FixResult, error)
ApplyToFile applies all fixes to a single file.
func (*Fixer) FindFixes ¶
func (f *Fixer) FindFixes(results []checker.Result) []FileChanges
FindFixes analyzes check results and returns fixable items grouped by file. Only redirects with a successful final destination (200) are considered fixable.
func (*Fixer) Preview ¶
func (*Fixer) Preview(changes []FileChanges) string
Preview returns a formatted string showing what changes would be made.
func (*Fixer) SetParserLinks ¶
SetParserLinks provides the original parser links for reference detection.