Skip to main content

normalize_content

Function normalize_content 

Source
pub fn normalize_content(content: &Content) -> String
Expand description

Normalize content for hashing.

This function produces a canonical string representation of any content type that can be used for deterministic ID generation.

ยงExample

use ucm_core::content::{Content, TextFormat};
use ucm_core::normalize::normalize_content;

let content = Content::Text(ucm_core::content::Text {
    text: "  Hello   World  ".to_string(),
    format: TextFormat::Plain,
});

let normalized = normalize_content(&content);
assert_eq!(normalized, "Hello World");