Repository navigation
Support multiple defined symbols - #15
Merged
Merged
Conversation
`symbol` now accepts several symbols: a string separated by spaces
and/or `|` ("DEBUG RELEASE", "DEBUG|RELEASE") or a list
(MkDocs: `symbol: [DEBUG, RELEASE]`). An `#if` is true when any
defined symbol is among its listed names. A single symbol behaves
exactly as before; None / [] define nothing.
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.
Closes #6
Summary
symbolcan now define several symbols, each usable as its own condition (like-Dflags in conditional compilation):#if A B/#if A | Bis true when any defined symbol is among the listed names (exact-name matching from Match symbols as whole names and validate block structure #13 unchanged)Noneand[]define nothing (every#iffalse), same as an empty stringThanks to @jmseguin for the request and @kamal-ahmed-maTha for the detailed spec in the issue thread — the tests use that example directly.
Test plan
uv run pytest— 32 passed, also on Markdown 3.2 / py3.10 (new: the Multiple Condition Symbols #6 example with space /|/ list / tuple / single / empty / None configs, any-of matching, loading by name with a list)mkdocs buildwithsymbol: [DEBUG, RELEASE]renders#if DEBUG,#elseof#if STAGING, and#if RELEASE|STAGINGcorrectly🤖 Generated with Claude Code
https://claude.ai/code/session_012pKTVb5TrGn27R29rHHNck