MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / strip_html_comments

Function strip_html_comments

atomic-canonical/src/directive.rs:273–285  ·  view source on GitHub ↗

Drop `<!-- … -->` spans so template guidance comments never trip the embedded-directive check.

(line: &str)

Source from the content-addressed store, hash-verified

271/// Drop `<!-- … -->` spans so template guidance comments never trip the
272/// embedded-directive check.
273fn strip_html_comments(line: &str) -> String {
274 let mut out = String::with_capacity(line.len());
275 let mut rest = line;
276 while let Some(open) = rest.find("<!--") {
277 out.push_str(&rest[..open]);
278 match rest[open..].find("-->") {
279 Some(close) => rest = &rest[open + close + 3..],
280 None => return out,
281 }
282 }
283 out.push_str(rest);
284 out
285}
286
287fn check_known(name: &str) -> Result<()> {
288 if !vocab::is_known_directive(name) {

Callers 1

Calls 1

lenMethod · 0.45

Tested by

no test coverage detected