Skip to content

fix: protect backtick spans before stripping markdown italic in docstring generator#175

Merged
Bucknalla merged 1 commit into
mainfrom
alex-fix-docstring-italic-regex-corrupting-identifiers
May 26, 2026
Merged

fix: protect backtick spans before stripping markdown italic in docstring generator#175
Bucknalla merged 1 commit into
mainfrom
alex-fix-docstring-italic-regex-corrupting-identifiers

Conversation

@Bucknalla
Copy link
Copy Markdown
Collaborator

Summary

  • The clean_docstring_text method in scripts/generate_apis.py was applying a _([^_]+)_ regex to strip markdown italic formatting, but this also matched underscores inside backtick-quoted identifiers
  • SERIAL_RX_BUFFER_SIZESERIALRXBUFFER_SIZE because _RX_ was treated as italic markdown and stripped
  • Fixed by temporarily saving all backtick spans before the emphasis-stripping pass, then restoring them afterward

This is the root cause behind #174 — the upstream schema has always had the correct SERIAL_RX_BUFFER_SIZE, but the generator was corrupting it on every automated build run.

Test plan

  • Verify SERIAL_RX_BUFFER_SIZE is preserved in notecard/card.py after running pipenv run python scripts/generate_apis.py --output-dir notecard
  • Confirm italic markdown like _italic_ outside of backticks is still stripped correctly
  • Close Fix typo in max parameter description #174 after this merges and an automated schema update runs

🤖 Generated with Claude Code

…ring generator

The _([^_]+)_ regex intended to strip _italic_ markdown was also matching
underscores inside backtick-quoted identifiers (e.g. SERIAL_RX_BUFFER_SIZE
→ SERIALRXBUFFER_SIZE). Backtick spans are now saved and restored around
the emphasis-stripping pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Bucknalla Bucknalla merged commit b0d3a7c into main May 26, 2026
6 checks passed
@Bucknalla Bucknalla deleted the alex-fix-docstring-italic-regex-corrupting-identifiers branch May 26, 2026 15:46
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.

2 participants