Documentation
¶
Overview ¶
Package mdlinks provides functions to verify cross links in a set of markdown files.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckFS ¶
CheckFS walks file system fsys looking for files with their base names matching pattern pat. It parses such files as markdown, looks for local urls (urls that only specify paths), and reports if it find any urls that point to non-existing files.
If returned error is a *BrokenLinksError, it describes found files with broken links.
Types ¶
type BrokenLink ¶
type BrokenLink struct {
File string // file path, relative to directory/filesystem scanned; uses '/' as a separator
Link LinkInfo
// contains filtered or unexported fields
}
BrokenLink describes broken markdown link and the file it belongs to.
func (BrokenLink) Reason ¶
func (b BrokenLink) Reason() string
func (BrokenLink) String ¶
func (b BrokenLink) String() string
type BrokenLinksError ¶
type BrokenLinksError struct {
Links []BrokenLink
}
BrokenLinksError is an error type returned by this package functions to report found broken links.
Usage example:
err := mdlinks.CheckFS(os.DirFS(dir), "*.md")
var e *mdlinks.BrokenLinksError
if errors.As(err, &e) {
for _, link := range e.Links {
log.Println(link)
}
}
func (*BrokenLinksError) Error ¶
func (e *BrokenLinksError) Error() string
Click to show internal directories.
Click to hide internal directories.