diff --git a/src/components-object.tsx b/src/components-object.tsx index 30239a3..d0e179a 100644 --- a/src/components-object.tsx +++ b/src/components-object.tsx @@ -28,6 +28,16 @@ import { isImageMime, } from "./_internal"; +// The reader loads a bounded window and reveals more on demand — a long +// document (this one is ~445k chars) must never render as a single wall. +const INITIAL_CHARS = 8000; +const MORE_CHARS = 12000; + +/** A section's display label — real heading, else a mechanical "Part N". */ +function sectionLabel(s: OutlineSection, index: number): string { + return s.heading?.trim() || `Part ${index + 1}`; +} + // ---- ObjectList ----------------------------------------------------------- export interface ObjectListProps { @@ -222,20 +232,21 @@ export const OutlineNav: FC<{ }> = ({ sections, activeId, onSelect, className }) => { if (sections.length === 0) return null; return ( -