diff --git a/src/to/html.rs b/src/to/html.rs
index 3d38808..09f0937 100644
--- a/src/to/html.rs
+++ b/src/to/html.rs
@@ -278,7 +278,9 @@ fn doc_to_impl<'a>(
out.push_str(&format!("{a}\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,10 +378,12 @@ fn doc_to_impl<'a>(
}
}
out.push_str("\n");
- doc_args
- .state
- .cache
- .insert(section, out[section_start..].to_owned());
+ 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("\n");