Skip to content

fix(tree_renderer): truncate overlong node titles in summary headings#167

Open
designcomputer wants to merge 1 commit into
VectifyAI:mainfrom
designcomputer:fix/pageindex-title-truncation
Open

fix(tree_renderer): truncate overlong node titles in summary headings#167
designcomputer wants to merge 1 commit into
VectifyAI:mainfrom
designcomputer:fix/pageindex-title-truncation

Conversation

@designcomputer

Copy link
Copy Markdown

Problem

PageIndex's no-TOC fallback structure generator sometimes copies an entire source sentence verbatim into a node's title when there's no natural short heading to extract (see VectifyAI/PageIndex#341). render_summary_md renders that title directly as a Markdown heading, producing unreadable, multi-line headings in wiki/summaries/*.md — e.g.:

### 1.1 The iOS version of the software requires that the device's running memory is not less than 2GB...

Fix

Add _short_title(): titles over 80 chars are truncated with when rendered as a heading. Only affects display in the summary — the full title still comes through from the underlying PageIndex tree unmodified.

Testing

Added two tests to tests/test_tree_renderer.py (overlong title truncates with ellipsis; short titles pass through unchanged). Full suite (928 tests after these additions) passes; ruff format, ruff check, and mypy openkb/tree_renderer.py are clean.

Found and verified while investigating PageIndex long-doc rendering quality for a real knowledge base — see the sibling PRs for two related fixes to the same renderer (duplicate summary collapsing, source-text rendering) plus a follow-up for embedded images (#166).

The no-TOC fallback structure generator sometimes copies an entire
source sentence verbatim into a node's title when there's no natural
short heading to extract (see VectifyAI/PageIndex#341), producing
unreadable multi-line Markdown headings in the rendered summary.

Truncate titles over 80 chars with an ellipsis when rendering the
heading. The full title is still available from the underlying
PageIndex tree; this only affects display in wiki/summaries/*.md.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant