Skip to content

Use instance variable for _in_heading state#13

Merged
thesmallstar merged 2 commits intomainfrom
fix/use-instance-var-for-heading-state
Mar 2, 2026
Merged

Use instance variable for _in_heading state#13
thesmallstar merged 2 commits intomainfrom
fix/use-instance-var-for-heading-state

Conversation

@thesmallstar
Copy link
Owner

Summary

  • Moves _in_heading from a class variable to an instance variable initialized in __init__
  • Fixes thread-safety issue: concurrent renders would interfere with each other via shared class state
  • Fixes sticky-state bug: if rendering threw between heading_open and heading_close, the flag would stay True for all future renders

Test plan

  • All 48 existing tests pass
  • No behavioral change — instance state is sufficient since the same renderer instance processes the full token stream

🤖 Generated with Claude Code

thesmallstar and others added 2 commits March 2, 2026 22:00
Class-level _in_heading is not thread-safe and can get stuck on True
if rendering throws between heading_open and heading_close. Move to
instance variable initialized in __init__ since the same renderer
instance processes the full token stream.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add tests for italic inside headings and partial bold headings.
Bump version for release with instance variable fix.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@thesmallstar thesmallstar merged commit 5db9961 into main Mar 2, 2026
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.

1 participant