Repository navigation
Fix code review findings in the preprocessor - #17
Merged
Merged
Conversation
- Directives inside code fences get their own lenient scope: complete blocks still apply, but malformed directives (and an #if left open at the fence end) stay as text instead of raising. Docs that show md-condition syntax in a fence no longer break the build - Accept YAML scalars as `symbol` (2024, 1.5, true) instead of crashing with TypeError; False is no longer treated as empty - Include the offending line's text in ConditionSyntaxError, since line numbers are offset by MkDocs front matter Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012pKTVb5TrGn27R29rHHNck
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes from the
/code-reviewofv0.1.8...HEAD, before releasing 0.2.0.Summary
```md+<!--- #else -->raisedConditionSyntaxErrorand aborted the whole MkDocs build (0.1.8 passed it through). Fences now form their own lenient scope:#if … #endifblocks inside a fence still apply (conditional code samples, as in 0.1.x)#else/#endifwithout#if, nested#if, duplicate#else) stay as text#ifstill open when the fence closes is rolled back to verbatim textsymbol: 2024/1.5/yescrashed withTypeError: 'int' object is not iterable; now stringified.Falseis no longer silently treated as "no symbols"line Nis offset;line 2: #endif without #if: '<!--- #endif -->'is findable regardlessTest plan
uv run pytest— 50 passed (newtests/test_fences.py: verbatim cases incl.~~~, longer fences, unterminated fence; conditional code samples; nested/duplicate in fence; outer block hiding a fence; errors outside fences still raise; YAML scalars; message text), also on Markdown 3.2 / py3.10mkdocs build: fenced#elseexample renders as code,symbol: 2024works, an error in a page with front matter reports the line text🤖 Generated with Claude Code
https://claude.ai/code/session_012pKTVb5TrGn27R29rHHNck