stylix icon indicating copy to clipboard operation
stylix copied to clipboard

Add `mkEnableTargetWith` and use it for documenting dynamic `autoEnable` conditions

Open MattSturgeon opened this issue 7 months ago • 6 comments

[!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.

image

image

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

Notify relevant people

  • @Flameopathic : related to mkTarget

MattSturgeon avatar May 09 '25 13:05 MattSturgeon

Rebased due to #1255

MattSturgeon avatar May 16 '25 00:05 MattSturgeon

merge conflict

0xda157 avatar May 20 '25 15:05 0xda157

merge conflict

Rebased :+1:

MattSturgeon avatar May 20 '25 15:05 MattSturgeon

Rebased for conflicts

MattSturgeon avatar May 21 '25 15:05 MattSturgeon

Updated mkTarget to use mkEnableTargetWith and support arguments like autoEnableExpr.

MattSturgeon avatar May 22 '25 14:05 MattSturgeon

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!

MattSturgeon avatar Jun 04 '25 14:06 MattSturgeon

Successfully created backport PR for release-25.05:

  • #1470

stylix-automation[bot] avatar Jun 09 '25 15:06 stylix-automation[bot]