Documentation
¶
Overview ¶
Package mdpatch replaces HTML-comment marker blocks in Markdown files and normalizes line endings for documentation snapshot workflows.
Index ¶
- func BuildPatchedContent(path string, data []byte, marker string, opts PatchOptions) ([]byte, error)
- func NormalizeEOL(data []byte, mode EOLMode) []byte
- func ParseFence(s string) (string, error)
- func PatchMarkdownFile(path string, out []byte, marker string, opts PatchOptions) error
- func ValidateMarker(marker string) error
- type EOLMode
- type PatchOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildPatchedContent ¶
func BuildPatchedContent(path string, data []byte, marker string, opts PatchOptions) ([]byte, error)
BuildPatchedContent returns the file bytes after replacing the marker block without writing to disk.
func NormalizeEOL ¶
NormalizeEOL applies the given line-ending normalization to data. EOLNone returns data unchanged.
func ParseFence ¶
ParseFence parses -fence values: text, none, or a language tag.
func PatchMarkdownFile ¶
func PatchMarkdownFile(path string, out []byte, marker string, opts PatchOptions) error
PatchMarkdownFile replaces the lines strictly between <!-- marker begin --> and <!-- marker end --> with fenced or raw content per opts.Fence.
func ValidateMarker ¶
ValidateMarker checks that marker is safe to embed in HTML comment markers.
Types ¶
type EOLMode ¶
type EOLMode int
EOLMode represents a line-ending normalization mode.
func ParseEOLMode ¶
ParseEOLMode parses a string into an EOLMode. Valid values are "none", "lf", and "crlf" (case-sensitive).
type PatchOptions ¶
type PatchOptions struct {
EOL EOLMode
Fence string // "text", "none", or a fenced-code language tag (e.g. "go")
}
PatchOptions configures marker-block replacement.