Preserve fenced Markdown blocks across message splits - #32
Conversation
Co-authored-by: PromoFaux <1998970+PromoFaux@users.noreply.github.com>
|
@copilot CI config has been fixed - please rebase on master |
…e-intelligent-text-splitting Co-authored-by: PromoFaux <1998970+PromoFaux@users.noreply.github.com>
Merged master in |
|
@copilot I don't currently have the ability to download and test this - but would love to see some screenshots or examples of this in action (adding markdown directly here may cause issues....) |
The focused example is in |
|
@copilot It might also be worth rolling in here an option to truncate rather than split, too. So that the end user has the ability to decide what they see |
Co-authored-by: PromoFaux <1998970+PromoFaux@users.noreply.github.com>
Implemented in |
PreserveFencedCodeBlocks reopened/closed fences after chunks were already packed to maxChunkSize, so the added fence lines could push a chunk past the requested size limit - defeating the point of maxMessageLength. SplitTextBySizePreservingWords now tracks fence state per word up front and reserves room for a closing fence before deciding a word still fits, so chunks stay within maxChunkSize (same caveat as before: a single word/fence-line bigger than maxChunkSize on its own still can't be shrunk further). Also trims leading whitespace before checking for a fence when choosing the sequence-number separator, so an indented reopened fence still gets its own line. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Long posts split mid-fenced code block, causing subsequent chunks to render as malformed Markdown. This preserves code-block formatting for each generated Mattermost message.
Fenced code continuity
Message numbering