Remove dead code (isAsteriskListMarker, redundant isWithinCodeBlock
checks, unreachable fallbacks) and replace defensive patterns (|| [],
?? defaults) with non-null assertions where invariants guarantee
safety. Add coverage-gaps test suite covering edge cases in emphasis,
link, strikethrough, HTML tag, math block, and horizontal rule handlers.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Added 23 test files covering components, hooks, mermaid, tables, markdown filtering, image handling, animation, code blocks, and more. Updated vitest config to exclude external packages from coverage.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add useIsBlockIncomplete hook for detecting incomplete streaming blocks
Custom components can now detect when the block they're rendering is still
being streamed (incomplete). This is useful for showing loading states in
code blocks during streaming.
- Add BlockIncompleteContext and useIsBlockIncomplete hook
- Add hasIncompleteCodeFence utility to detect unclosed code fences
- Calculate isIncomplete state per block during render
- Default CodeComponent uses the hook to set data-incomplete attribute
- Add comprehensive tests for the new functionality
* docs: add useIsBlockIncomplete documentation
- Add "Streaming State" section to components.mdx explaining the hook
- Add "Avoid Continuous Re-rendering" section to mermaid.mdx with example
* fix: support tilde code fences in hasIncompleteCodeFence
Adds support for detecting incomplete ~~~ code fences in addition to
backtick fences, per CommonMark/GFM spec.
* fix: address PR review — line-based fence detection, rename hook/context
- rewrite hasIncompleteCodeFence to walk line-by-line per CommonMark spec
- fixes 6+ backtick fences being miscounted
- fixes false positives from inline backticks in prose
- respects fence character matching and length requirements
- rename block-position-context.ts → block-incomplete-context.ts
- rename useIsBlockIncomplete → useIsCodeFenceIncomplete
- add tests for edge cases (long fences, inline backticks, indentation)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Hayden Bleasel <hello@haydenbleasel.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
When processing HTML like `<a target="_blank">`, the underscore in
`_blank` was being counted as an unclosed emphasis marker, causing
remend to append a trailing `_` to close it.
Added `isWithinHtmlTag()` check to `shouldSkipUnderscore()` — if the
underscore is between `<` and `>` of an HTML tag, it's skipped for
emphasis counting.
Fixes#385
Co-authored-by: Shurik <shurik@openclaw.ai>
* Add support for copying table data as Markdown in TableCopyDropdown
* Refactor content generation in TableCopyDropdown to use formatters for cleaner code
* docs: add changeset