MCPcopy Create free account
hub / github.com/github/gh-aw / normalizeFrontmatterText

Function normalizeFrontmatterText

pkg/parser/frontmatter_hash.go:293–298  ·  view source on GitHub ↗

normalizeFrontmatterText normalizes frontmatter text for consistent hashing Removes leading/trailing whitespace and normalizes line endings

(text string)

Source from the content-addressed store, hash-verified

291// normalizeFrontmatterText normalizes frontmatter text for consistent hashing
292// Removes leading/trailing whitespace and normalizes line endings
293func normalizeFrontmatterText(text string) string {
294 // Normalize Windows line endings to Unix
295 normalized := strings.ReplaceAll(text, "\r\n", "\n")
296 // Trim leading and trailing whitespace
297 return strings.TrimSpace(normalized)
298}
299
300func validateFrontmatterHashInputSize(normalizedFrontmatterText string, normalizedImportedFrontmatterTexts []string) error {
301 totalBytes := len(normalizedFrontmatterText)

Calls

no outgoing calls

Tested by

no test coverage detected