markdown

package
v0.24.1 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: AGPL-3.0 Imports: 10 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 Markdown path is a test file. Markdown documents have no widely shared test-file convention, so every Markdown file is treated as production content.

func ResolveMarkdownLinkPath

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

ResolveMarkdownLinkPath resolves a Markdown link target against the source file's directory and returns matching project files.

Static-site generators (VitePress, Docusaurus, Astro Starlight) link between docs with site-absolute URLs ("/guide/foo"). Those don't share the filesystem root, so we resolve them by suffix-matching the supplied project files.

func ResolveMarkdownProjectImports

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

ResolveMarkdownProjectImports extracts link targets from a Markdown file and returns the supplied project paths they resolve to.

Types

type MarkdownLink struct {
	// contains filtered or unexported fields
}

MarkdownLink represents a link, image, or reference-definition target extracted from a Markdown file.

func MarkdownLinks(filePath string) ([]MarkdownLink, error)

MarkdownLinks reads a Markdown file and returns its extracted link targets.

func ParseMarkdownLinks(sourceCode []byte) []MarkdownLink

ParseMarkdownLinks extracts link, image, and reference-definition targets from Markdown source using tree-sitter. Code spans, fenced code blocks, and other non-link content are correctly excluded by the grammar.

func (MarkdownLink) IsImage

func (l MarkdownLink) IsImage() bool

IsImage reports whether the link came from an image syntax (`![alt](path)`).

func (MarkdownLink) Path

func (l MarkdownLink) Path() string

Path returns the raw destination text from the Markdown source, with any URL fragment, query string, or surrounding quotes stripped.

type Module

type Module struct{}

func (Module) Extensions

func (Module) Extensions() []string

func (Module) IsTestFile

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

func (Module) Maturity

func (Module) Maturity() moduleapi.MaturityLevel

func (Module) Name

func (Module) Name() string

func (Module) NewResolver

func (Module) 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