You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cluster heading levels on indent and alignment, preserve authoritative
Two extensions to AssignHeadingLevels.
- Headings that arrive with HeadingLevel != 0 are treated as
authoritative and left untouched. The classifier convention is now
inverted: FontBasedElementClassifier emits HeadingLevel = 0 (label
empty) so AssignHeadingLevels can cluster the heading among its
style siblings, while a pattern-driven classifier such as
RegexHeadingClassifier sets a specific HeadingLevel per matched
pattern and that level survives the assignment pass. The hierarchy
a regex classifier intentionally encodes (chapter = 2, section = 3,
…) is no longer overwritten by a typography-only re-clustering.
- Indent and alignment join the style key. The clustering used to be
(font size, bold, font name); a document whose chapter, section,
and sub-section headings share font and weight but sit at distinct
left margins all collapsed into a single level. Add an indent
bucket (rounded to 5pt) and a coarse alignment rank (centred vs
left-aligned) so visually distinct layout roles cluster into
distinct levels, while still letting font size dominate the
ordering.
Tests pass (78/78) and the playground heading-count distribution is
unchanged on fixtures that were already clean — the indent+alignment
extensions are activated only when style alone fails to discriminate
levels, which the current playground does not exercise heavily;
they are groundwork for fixtures with monolithic typography
(legal-style hierarchies that ride on indent, primarily).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
/// <summary>Creates a <see cref="HeadingElement"/> for the given block. Heading level is provisional (always 1) and is refined by a later pass that clusters headings by typographic style.</summary>
584
+
/// <summary>
585
+
/// Creates a <see cref="HeadingElement"/> for the given block. The heading
586
+
/// level is left unassigned (<c>0</c>) and the label empty so the
587
+
/// downstream <c>AssignHeadingLevels</c> pass can cluster the heading
588
+
/// alongside its style siblings. A regex- or pattern-driven classifier
589
+
/// that knows the heading's hierarchical level emits non-zero values
0 commit comments