perf(markdown): eliminate duplicate clean_html call in generate_toc_html
clean_html() triggers expensive ammonia sanitization with aho_corasick. Previously called twice for the same text (aria-label + display text). Now calls once and reuses the result.
This commit is contained in:
parent
2e9d123396
commit
f6589121da
@ -228,11 +228,12 @@ fn generate_toc_html(headings: &[(u8, String, String)]) -> String {
|
||||
}
|
||||
}
|
||||
|
||||
let clean_text = clean_html(text);
|
||||
html.push_str(&format!(
|
||||
"<li><a href=\"#{}\" aria-label=\"{}\">{}</a>",
|
||||
id,
|
||||
clean_html(text),
|
||||
clean_html(text)
|
||||
clean_text,
|
||||
clean_text
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user