markdown

package
v0.0.0-...-e7b98f1 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2025 License: MIT Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CodeBlock

type CodeBlock struct {
	Language string
	Content  string
	Line     int
}

CodeBlock represents an extracted code block from markdown

type Section

type Section struct {
	Heading string
	Level   int
	Content string
	Line    int
}

Section represents a markdown section with heading and content

type ValidationError

type ValidationError struct {
	Line    int
	Message string
}

ValidationError represents a validation error

type ValidationResult

type ValidationResult struct {
	FilePath   string
	Valid      bool
	Errors     []ValidationError
	Warnings   []ValidationWarning
	CodeBlocks []CodeBlock
	Sections   []Section
	LineCount  int
	ByteCount  int
}

ValidationResult holds validation results for a markdown file

type ValidationWarning

type ValidationWarning struct {
	Line    int
	Message string
}

ValidationWarning represents a validation warning

type Validator

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

Validator validates markdown files

func NewValidator

func NewValidator(opts ValidatorOptions, writer io.Writer) *Validator

NewValidator creates a new markdown validator

func (*Validator) PrintResults

func (v *Validator) PrintResults(results []ValidationResult, moduleRoot string) int

PrintResults prints validation results to the configured writer

func (*Validator) ValidateDirectory

func (v *Validator) ValidateDirectory(rootDir string) ([]ValidationResult, error)

ValidateDirectory validates all markdown files in a directory

func (*Validator) ValidateFile

func (v *Validator) ValidateFile(filePath string) ValidationResult

ValidateFile validates a single markdown file

type ValidatorOptions

type ValidatorOptions struct {
	// ValidateCodeBlocks enables code block syntax validation
	ValidateCodeBlocks bool

	// RequiredSections lists section headings that must be present
	RequiredSections []string

	// CheckHeadingHierarchy ensures proper heading level progression
	CheckHeadingHierarchy bool

	// ExcludeDirs lists directories to skip during validation
	ExcludeDirs []string

	// AllowEmptyFiles allows empty markdown files
	AllowEmptyFiles bool
}

ValidatorOptions configures markdown validation

func DefaultValidatorOptions

func DefaultValidatorOptions() ValidatorOptions

DefaultValidatorOptions returns sensible defaults

Jump to

Keyboard shortcuts

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