Skip to content

Conversation

@FrancisMengx
Copy link
Contributor

@FrancisMengx FrancisMengx commented Aug 14, 2025

Summary
Replaces regex-based markdown parsing with a character-by-character state machine to support nested and overlapping formatting like bold italic, bold nested italic text, and strike italic through.

Key Changes
applyTextFormatting.ts: Complete rewrite using state-driven parsing instead of regex splitting
applySegmentFormatting.ts: Enhanced to handle null returns from heading adjustment
adjustHeading.ts: Now returns null for empty segments after heading removal
Tests: Added comprehensive coverage for nested formatting scenarios
Features Added
✅ Nested formatting: text, bold italic bold
✅ Overlapping styles: italic bold italic
✅ Mixed formatting: strike italic through
✅ Proper state management with toggle-based formatting
✅ Edge case handling for marker-only inputs
Technical Improvements
Character-by-character parsing for better performance
Type-safe formatting state management
Original segment preservation when no formatting applied
Null-safe segment processing
Files changed: 3 core files + 5 test files with 334 insertions, 54 deletions

@FrancisMengx FrancisMengx force-pushed the add-support-for-nested-style-markdown branch from 6f10999 to c00c270 Compare August 14, 2025 19:01
Copy link
Contributor

@juliaroldi juliaroldi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @FrancisMengx, I find a small regression in this change, if you transform **test** ~~ *test* it will result in

Image the ~~ is causing the next word to have strikethrough without the closing characters.

@FrancisMengx FrancisMengx force-pushed the add-support-for-nested-style-markdown branch from 6191288 to 6b5f0e0 Compare August 21, 2025 22:26
@FrancisMengx FrancisMengx force-pushed the add-support-for-nested-style-markdown branch from 518afa7 to de2a396 Compare August 21, 2025 23:15
@FrancisMengx FrancisMengx merged commit 6464adf into master Aug 22, 2025
7 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.

4 participants