From c66fd6b7cd2c00a9d6891e1e589ba00dc2411e4b Mon Sep 17 00:00:00 2001 From: Mark Date: Wed, 25 Mar 2026 13:53:59 +0100 Subject: [PATCH] fix: caching inaccuracy --- src/to/html.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) 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");