normalize_markdown

Function normalize_markdown 

Source
pub fn normalize_markdown(markdown: &str) -> String
Expand description

Normalizes markdown content by applying all preprocessing steps.

This function applies normalizations in the correct order:

  1. Strip Unicode bidirectional formatting characters
  2. Fix HTML comment closing fences (ensure text after --> is preserved)

Note: Guillemet preprocessing (<<text>>«text») is handled separately in normalize_fields because it needs to be applied after schema defaults and coercion.

§Examples

use quillmark_core::normalize::normalize_markdown;

// Bidi characters are stripped
let input = "**bold** \u{202D}**more**";
let normalized = normalize_markdown(input);
assert_eq!(normalized, "**bold** **more**");

// HTML comment trailing text is preserved
let with_comment = "<!-- comment -->Some text";
let normalized = normalize_markdown(with_comment);
assert_eq!(normalized, "<!-- comment -->\nSome text");