Help us shape the future of Go! Take the 2026 Go Developer Survey

html

package
v0.34.0 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsTestFile

func IsTestFile(_ string) bool

IsTestFile reports whether the given HTML path is a test file. HTML documents have no widely shared test-file convention, so every HTML file is treated as production content.

func ParseHTMLLinks(sourceCode []byte) []string

ParseHTMLLinks extracts file-reference destinations from `href` / `src` attributes in HTML source. Values are normalized: external URLs, anchors, and non-file references are dropped. Attribute parsing is driven by tree-sitter, so destinations inside comments or element text are never matched.

func ResolveHTMLLinkPath

func ResolveHTMLLinkPath(sourceFile, linkPath string, suppliedFiles map[string]bool) []string

ResolveHTMLLinkPath resolves an HTML link target against the source file's directory and returns matching project files.

Server-absolute links ("/css/app.css") do not share the filesystem root, so they are resolved by suffix-matching the supplied project files, mirroring the Markdown resolver.

func ResolveHTMLProjectImports

func ResolveHTMLProjectImports(
	absPath string,
	_ string,
	_ string,
	suppliedFiles map[string]bool,
	contentReader vcs.ContentReader,
) ([]string, error)

ResolveHTMLProjectImports extracts link/asset references from an HTML file and returns the supplied project paths they resolve to.

Types

type HTMLLinkLocation added in v0.30.0

type HTMLLinkLocation struct {
	Element   string
	Attribute string
	Path      string
	Line      int
}

HTMLLinkLocation is one file reference from an HTML element attribute.

func ParseHTMLLinkLocations added in v0.30.0

func ParseHTMLLinkLocations(sourceCode []byte) []HTMLLinkLocation

ParseHTMLLinkLocations extracts element, attribute, destination, and 1-based source line for every project-file-like HTML reference.

type Provider

type Provider struct{}

func (Provider) Extensions

func (Provider) Extensions() []string

func (Provider) IsTestFile

func (Provider) IsTestFile(filePath string, _ vcs.ContentReader) bool

func (Provider) Maturity

func (Provider) Maturity() moduleapi.MaturityLevel

func (Provider) Name

func (Provider) Name() string

func (Provider) NewResolver

func (Provider) NewResolver(ctx *moduleapi.Context, contentReader vcs.ContentReader) moduleapi.Resolver

Jump to

Keyboard shortcuts

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