Fix smart quotes to not apply inside Markdoc/Jinja/HTML tags #16
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
TEMPLATE_TAG_PATTERNtotag_handling.pyfor centralized template tag matchingsmart_quotes()to protect content inside template tags from conversionBug Details
When arrays or objects spanned multiple lines inside Markdoc/Jinja tags, quotes at the start of continuation lines were being converted to smart quotes. For example:
{% field examples=["red", "blue"] %}The
"blue"was being converted to"blue"(curly quotes), breaking the template syntax.Changes
tag_handling.py: Add
TEMPLATE_TAG_PATTERNregex to match complete template tags ({% %},{# #},{{ }},<!-- -->) including multiline tagssmartquotes.py: Refactor to split text into protected (inside tags) and unprotected (outside tags) segments, applying smart quote conversion only to prose text
test_tag_formatting.py: New test file with 22 tests covering:
Test plan
make lintpasses with no warnings{% %},{# #},{{ }}, and<!-- -->tags preserved🤖 Generated with Claude Code