Fenced code is trimmed in one pass. Release 0.3.1. #3

Closed
oliver.maklott wants to merge 0 commits from oliver.maklott/linear-trim into main AGit

The fence scanner trimmed each block with /\s+$/. On a block that holds a long run of whitespace followed by more text, the regex rescans the run from each of its characters: 200 KB of blanks took over 20 s in the app process. trimEnd() removes the same characters in one pass.

Tests: highlight-markdown.test.ts (one new).

🤖 Generated with Claude Code

https://claude.ai/code/session_01PVUe4ghusFjH71tHhZetH2

The fence scanner trimmed each block with `/\s+$/`. On a block that holds a long run of whitespace followed by more text, the regex rescans the run from each of its characters: 200 KB of blanks took over 20 s in the app process. `trimEnd()` removes the same characters in one pass. Tests: `highlight-markdown.test.ts` (one new). 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01PVUe4ghusFjH71tHhZetH2
Fenced code is trimmed with trimEnd: a long run of whitespace inside a block is scanned once. Release 0.3.1.
All checks were successful
Publish / dev-image (pull_request) Successful in 1s
Publish / test (pull_request) Successful in 57s
Publish / pack-and-publish (pull_request) Has been skipped
ab369f7b67
/\s+$/ rescanned the run from each of its characters: 200 KB of blanks
followed by a letter inside one block took over twenty seconds.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PVUe4ghusFjH71tHhZetH2
oliver.maklott closed this pull request 2026-11-15 16:46:45 +01:00
All checks were successful
Publish / dev-image (pull_request) Successful in 1s
Publish / test (pull_request) Successful in 57s
Publish / pack-and-publish (pull_request) Has been skipped

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
limedoc-plugins/shiki!3
No description provided.