docgov saves content hashes through the new leaf module so it no longer imports docrevision. Existing docrevision exports stay as thin wrappers. Co-authored-by: Cursor <cursoragent@cursor.com>
37 lines
691 B
Go
37 lines
691 B
Go
package docrevision
|
|
|
|
import (
|
|
"strings"
|
|
"unicode"
|
|
"unicode/utf8"
|
|
|
|
"chat-agent-system/internal/doccontent"
|
|
)
|
|
|
|
func CanonicalizeMarkdown(raw string) string {
|
|
return doccontent.CanonicalizeMarkdown(raw)
|
|
}
|
|
|
|
func LegacyDestructiveCanonicalizeMarkdown(raw string) string {
|
|
return doccontent.LegacyDestructiveCanonicalizeMarkdown(raw)
|
|
}
|
|
|
|
func SHA256Hex(content string) string {
|
|
return doccontent.SHA256Hex(content)
|
|
}
|
|
|
|
func ContentFingerprint(s string) string {
|
|
var b strings.Builder
|
|
for _, r := range strings.ToLower(s) {
|
|
if unicode.IsSpace(r) {
|
|
continue
|
|
}
|
|
b.WriteRune(r)
|
|
}
|
|
return SHA256Hex(b.String())[:16]
|
|
}
|
|
|
|
func RuneCount(s string) int {
|
|
return utf8.RuneCountInString(s)
|
|
}
|