lint

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package lint provides markdown linting functionality for markata-go. It detects common issues in markdown files that can cause build failures.

Supported Checks

The linter detects the following issues:

  • Duplicate YAML keys in frontmatter
  • Invalid date formats (non-ISO 8601)
  • Malformed image links (missing alt text)
  • Protocol-less URLs (//example.com instead of https://example.com)

All issues can be auto-fixed using the Fix function.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Issue

type Issue struct {
	File       string   // File path
	Line       int      // Line number (1-indexed)
	Column     int      // Column number (1-indexed, 0 if not applicable)
	Type       string   // Issue type (e.g., "duplicate-key", "invalid-date")
	Severity   Severity // Severity level
	Message    string   // Human-readable message
	FixApplied bool     // Whether fix was applied
}

Issue represents a linting issue found in a file.

type Result

type Result struct {
	File    string  // File path
	Issues  []Issue // Issues found
	Content string  // Original content
	Fixed   string  // Fixed content (same as Content if no fixes)
}

Result contains the linting results for a file.

func Fix

func Fix(filePath, content string) *Result

Fix applies automatic fixes to the content and returns the fixed content.

func Lint

func Lint(filePath, content string) *Result

Lint analyzes content and returns any issues found.

func (*Result) HasErrors

func (r *Result) HasErrors() bool

HasErrors returns true if any issues are errors.

type Severity

type Severity int

Severity indicates the severity of a linting issue.

const (
	SeverityError Severity = iota
	SeverityWarning
	SeverityInfo
)

func (Severity) String

func (s Severity) String() string

Jump to

Keyboard shortcuts

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