fix: caching inaccuracy

This commit is contained in:
Mark
2026-03-25 13:53:59 +01:00
parent deac3524a3
commit c66fd6b7cd

View File

@@ -278,7 +278,9 @@ fn doc_to_impl<'a>(
out.push_str(&format!("</span>{a}</div>\n"));
}
for section in &doc.sections {
if let Some(prev) = doc_args.state.cache.get(section) {
if doc_args.max_len.is_none()
&& let Some(prev) = doc_args.state.cache.get(section)
{
out.push_str(prev);
continue;
}
@@ -376,11 +378,13 @@ fn doc_to_impl<'a>(
}
}
out.push_str("</div>\n");
if doc_args.max_len.is_none() {
doc_args
.state
.cache
.insert(section, out[section_start..].to_owned());
}
}
for _ in depth..=doc.depth {
out.push_str("</div>\n");
}