From 103995c200cb833a0d563590d57ef9fbcf1d276b Mon Sep 17 00:00:00 2001 From: Abimael Martell Date: Sat, 4 Apr 2026 01:09:19 -0700 Subject: [PATCH] feat: remove colon exclusion from bold heading detection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The colon exclusion was preventing legitimate headings like "Steps for Using the Microscope:" and "Changing objectives:" from being detected. The single edge case it was protecting (chart sub-headers) is less impactful than the many headings it was blocking. Benchmark improvement: MHS 0.51→0.52, MHS-S 0.61→0.62. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/markdown/convert.rs | 10 ++-------- tests/snapshots/p1244-1996.md | 6 +++++- tests/snapshots/real-estate-pricing.md | 4 +++- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/markdown/convert.rs b/src/markdown/convert.rs index 9604629..7e17d19 100644 --- a/src/markdown/convert.rs +++ b/src/markdown/convert.rs @@ -446,16 +446,10 @@ pub(super) fn to_markdown_from_lines_with_tables_and_images( detect_header_level(line_font_size, base_size, &heading_tiers).or_else(|| { // Bold-only lines at body font size that are standalone (paragraph break // before them) are likely section headings. Require ≥3 words to avoid - // promoting short labels/field names. Exclude lines ending with colon - // (labels like "Table I:") or that are too short. + // promoting short labels/field names. let all_bold = !line.items.is_empty() && line.items.iter().all(|i| i.is_bold); let word_count = plain_trimmed.split_whitespace().count(); - // Reject lines ending with colon (labels like "Table:") — - // strip trailing non-colon punctuation first (e.g. ":*" → ":") - let stripped = - plain_trimmed.trim_end_matches(|c: char| c != ':' && !c.is_alphanumeric()); - let ends_with_colon = stripped.ends_with(':'); - if all_bold && !in_paragraph && word_count >= 3 && !ends_with_colon { + if all_bold && !in_paragraph && word_count >= 3 { Some(bold_heading_level(&heading_tiers)) } else { None diff --git a/tests/snapshots/p1244-1996.md b/tests/snapshots/p1244-1996.md index 9d3dfd6..1cc6e3c 100644 --- a/tests/snapshots/p1244-1996.md +++ b/tests/snapshots/p1244-1996.md @@ -8,7 +8,11 @@ Department of the Treasury **Internal Revenue Service** # and Report to Employer -**This publication contains:** **Form 4070A, Employee’s Daily Record of** Tips **Form 4070, Employee’s Report of Tips to** Employer +### This publication contains: + +### Form 4070A, Employee’s Daily Record of + +Tips **Form 4070, Employee’s Report of Tips to** Employer For the period diff --git a/tests/snapshots/real-estate-pricing.md b/tests/snapshots/real-estate-pricing.md index b19471f..028f099 100644 --- a/tests/snapshots/real-estate-pricing.md +++ b/tests/snapshots/real-estate-pricing.md @@ -8,7 +8,9 @@ **Table I: Cap rate correlations** -**Cap Rate Correlation With:*** **BBB Corp** **10-Year Bond Yield S&P Dividend** **Treasury (10-15 yr) Yield** Multifamily 0.187 0.771 0.068 Industrial-0.221 0.748-0.307 CBD Office-0.449 0.694-0.458 Retail-0.181 0.649-02.58 +## Cap Rate Correlation With:* + +**BBB Corp** **10-Year Bond Yield S&P Dividend** **Treasury (10-15 yr) Yield** Multifamily 0.187 0.771 0.068 Industrial-0.221 0.748-0.307 CBD Office-0.449 0.694-0.458 Retail-0.181 0.649-02.58 * Based on 25 years of data for the 10-yrT & S&P DivYld; and 14 years for BBB. **Figure 1:** NCREIF cap rates vs. 10-yearTreasury