doclint

package
v1.15.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 26, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package doclint extracts the link graph from the repository's Markdown so a test can assert it resolves. It is test-support code, not API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Anchors

func Anchors(doc string) map[string]bool

Anchors returns every anchor the document defines, in the form GitHub would serve them. Repeated heading text disambiguates with a numeric suffix, the same way GitHub does, so two "### Notes" headings yield "notes" and "notes-1".

func Slug

func Slug(heading string) string

Slug renders heading text the way GitHub anchors it.

Types

type Link struct {
	// Target is the raw path before any '#', empty for a same-file anchor.
	Target string
	// Fragment is the anchor without its '#', empty when the link has none.
	Fragment string
	// Line is the 1-indexed line it appeared on, so a failure can be clicked.
	Line int
}

Link is one inline Markdown link, split into the parts that can rot independently: the file it names and the heading anchor within it.

func Links(doc string) []Link

Links returns every inline link in the document that points somewhere this repository controls. External schemes are skipped: a test must not depend on the network, and a dead vendor URL is not something a build should fail on.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL