Skip to content

Comments

fix: smart markdown body filter for gh issue/pr view#214

Merged
pszymkowiak merged 1 commit intortk-ai:masterfrom
jbronssin:fix/188-gh-body-truncation
Feb 19, 2026
Merged

fix: smart markdown body filter for gh issue/pr view#214
pszymkowiak merged 1 commit intortk-ai:masterfrom
jbronssin:fix/188-gh-body-truncation

Conversation

@jbronssin
Copy link
Contributor

Summary

  • Replace truncated body display (3 lines + 80 chars/line) with intelligent markdown filtering
  • filter_markdown_body() removes noise while preserving all meaningful content
  • Code blocks (``` / ~~~) are preserved untouched

Filters applied (outside code blocks):

  • HTML comments <!-- ... --> (single + multiline)
  • Badge lines [![...](img)](link)
  • Image-only lines ![alt](url)
  • Horizontal rules (---, ***, ___)
  • 3+ consecutive blank lines → 1 blank line

Preserved: text, headers, lists, links, tables, code blocks

Test plan

  • 10 unit tests added (HTML comments, badges, images, rules, blank lines, code blocks, empty body, meaningful content, token savings ≥30%)
  • cargo fmt --all && cargo clippy --all-targets && cargo test passes (406 tests, 0 failures)
  • Manual test: rtk gh issue view 188 — full body, filtered
  • Manual test: rtk gh pr view <N> — full body, filtered

Closes #188

🤖 Generated with Claude Code

Replace truncated body display (3 lines + 80 chars) with intelligent
markdown filtering that preserves all meaningful content while removing
noise (HTML comments, badges, image-only lines, horizontal rules,
excessive blank lines). Code blocks are preserved untouched.

Closes rtk-ai#188
@jbronssin jbronssin force-pushed the fix/188-gh-body-truncation branch from b1adc18 to c3e8d8e Compare February 19, 2026 06:46
@jbronssin
Copy link
Contributor Author

Manual testing: before / after

rtk gh pr view 214

Before (master) — body truncated to 3 lines + 80 chars:

🟢 PR #214: fix: smart markdown body filter for gh issue/pr view
  jbronssin
  OPEN | ✓
  Checks: 0/0 passed
  https://github.com/rtk-ai/rtk/pull/214

  ## Summary
  - Replace truncated body display (3 lines + 80 chars/line) with intelligent m...
  ... (gh pr view 214 for full)

After (this branch) — full body, markdown noise filtered:

🟢 PR #214: fix: smart markdown body filter for gh issue/pr view
  jbronssin
  OPEN | ✓
  Checks: 0/0 passed
  https://github.com/rtk-ai/rtk/pull/214

  ## Summary
  
  - Replace truncated body display (3 lines + 80 chars/line) with intelligent markdown filtering
  - `filter_markdown_body()` removes noise while preserving all meaningful content
  - Code blocks (``` / ~~~) are preserved untouched
  
  **Filters applied (outside code blocks):**
  - HTML comments `<!-- ... -->` (single + multiline)
  - Badge lines `[![...](img)](link)`
  - Image-only lines `![alt](url)`
  - Horizontal rules (`---`, `***`, `___`)
  - 3+ consecutive blank lines → 1 blank line
  
  **Preserved:** text, headers, lists, links, tables, code blocks
  
  ## Test plan
  
  - [x] 10 unit tests added
  - [x] cargo fmt + clippy + test passes (406 tests, 0 failures)
  - [ ] Manual test: rtk gh issue view 188
  - [ ] Manual test: rtk gh pr view <N>
  
  Closes #188

rtk gh issue view 188

Before (master) — body truncated:

🟢 Issue #188: Impossible to get full Github Issue content...
  Author: @jbronssin
  Status: OPEN
  URL: https://github.com/rtk-ai/rtk/issues/188

  Description:
    Thanks for this great work!
    But unfortunately, just realized that when Claude code tries to get the full ...

After (this branch) — full body:

🟢 Issue #188: Impossible to get full Github Issue content...
  Author: @jbronssin
  Status: OPEN
  URL: https://github.com/rtk-ai/rtk/issues/188

  Description:
    Thanks for this great work!
    
    But unfortunately, just realized that when Claude code tries to get the full content from a GH Issue, it keeps answering with truncated data.
    Where it's a very good idea when getting a lot of issues at the same time, it should not be truncated when getting the data from only one issue.
    
    Right now, it's impossible to work on any given issue if the content is longer than 21 lines apparently...
    
    Thanks for your help!

@pszymkowiak
Copy link
Collaborator

Clean PR, well tested. Smart approach — filtering markdown noise instead of truncating is the right call.

Code block preservation works well (tested the edge cases). lazy_static! for all regex, graceful handling of unclosed fences, applied to both view_pr and view_issue. 10 tests including
token savings — solid.

One minor nit (not blocking): find("").or_else(|| find("~~~")) always picks even if ~~~ appears first in the text. Should take min() of both positions. Extremely rare edge case
though, no one mixes fence styles.

Good to merge — thanks!

@pszymkowiak pszymkowiak merged commit 4208015 into rtk-ai:master Feb 19, 2026
2 of 3 checks passed
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.

Impossible to get full Github Issue content, even by getting the full raw markdown

2 participants