Skip to content

Conversation

@remorses
Copy link
Owner

Adds an onHighlightComplete callback to CodeRenderable and DiffRenderable that fires when async syntax highlighting finishes.

Use case: When capturing TUI output to generate static HTML (e.g., for web previews), syntax highlighting is async via tree-sitter. Without knowing when highlighting completes, you have to guess with arbitrary timeouts. This callback enables deterministic capture - wait for the callback before capturing output.

Example in critique (diff viewer):

// Before: guess with timeout, often miss highlighting
setTimeout(() => captureOutput(), 1000)

// After: wait for highlighting to complete
<diff 
  diff={content}
  onHighlightComplete={() => captureOutput()}
/>

For DiffRenderable with split view (2 CodeRenderables), the callback fires when both sides complete highlighting.

@remorses remorses force-pushed the add-on-highlight-complete-callback-v2 branch 2 times, most recently from a33eec0 to 501b80d Compare December 24, 2025 20:11
@remorses remorses force-pushed the add-on-highlight-complete-callback-v2 branch from 501b80d to 22e3dc8 Compare December 24, 2025 20:13
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.

2 participants