Add `mkEnableTargetWith` and use it for documenting dynamic `autoEnable` conditions
[!NOTE] This PR is comprised of intentionally separate commits, please don't squash :slightly_smiling_face:
This is a solution to the issues uncovered by #1212. This should fix #98 (not tested).
- Avoid evaluating dynamic conditions while rendering the docs.
- Define literal expressions describing dynamic conditions.
- Tested: all workarounds can be removed in #1212, when merged with this PR.
Previously, the literal markdown same as `stylix.autoEnable` was used. When an additional conditionText is supplied, it will now use the literal expression stylix.autoEnable && ${expr}.
If the expr contains any nix operators with a lower priority than &&, it will be auto-wrapped in parentheses, unless autoWrapExpr = false is used.
We could stick with the previous markdown approach, but I'm unsure what the best way to approach merging it with a autoEnableExpr or autoEnableText or autoEnableMD style arg would be. Suggestions and/or followup PRs welcome.
Things done
- [x] Tested locally
- [ ] Tested in testbed
- [x] Commit message follows commit convention
- [ ] Fits style guide
- [ ] Respects license of any existing code used
Notify relevant people
- @Flameopathic : related to
mkTarget
Rebased due to #1255
merge conflict
merge conflict
Rebased :+1:
Rebased for conflicts
Updated mkTarget to use mkEnableTargetWith and support arguments like autoEnableExpr.
I would adapt my previous merge commit message (not squash commit message) proposal to the following:
SGTM
Let's optimistically close #98 with this patchset. If this issue is in fact not resolved, we can simply re-open it.
SGTM. There are likely other cases of unintentionally dynamic docs values this PR hasn't caught, since it doesn't introduce any enforcement. But let's be optimistic for now!
Successfully created backport PR for release-25.05:
- #1470