Skip to main content

strip_comments

Function strip_comments 

Source
pub fn strip_comments(content: &str) -> String
Expand description

Strip comments from document content for diff comparison.

Removes:

  • HTML comments <!-- ... --> (single and multiline) — EXCEPT agent range markers
  • Link reference comments [//]: # (...)

Skips <!-- sequences inside fenced code blocks and inline backtick spans to prevent code examples containing <!-- from being misinterpreted as comment starts.

This function is the shared implementation used by both diff::compute (binary) and external crates like eval-runner.