diff --git a/examples/requirements.typ b/examples/requirements.typ index 564d855..e71faa7 100644 --- a/examples/requirements.typ +++ b/examples/requirements.typ @@ -1 +1,2 @@ #import "@preview/cetz:0.3.1" +#import "@preview/cetz-plot:0.1.0" diff --git a/justfile b/justfile index 7dade36..6693d8b 100644 --- a/justfile +++ b/justfile @@ -53,5 +53,7 @@ update-test-refs: typst-test util export for dir in tests/*/out; do - mv "$dir" "$(dirname "$dir")/ref" + refpath="$(dirname "$dir")/ref" + mkdir -p "$refpath" + mv "$dir"/* "$refpath" done diff --git a/src/styling/code.typ b/src/styling/code.typ index e4b94a4..67cd1bb 100644 --- a/src/styling/code.typ +++ b/src/styling/code.typ @@ -41,12 +41,16 @@ #box(..config, it) ] - #show raw.where(block: true): it => ( + #show raw.where(block: true): it => { + if not code-block { + return it + } + context [ #let config = default-code-block-config + (fill: palette.colors.crust.rgb) + block-config #block(..config, it) ] - ) + } #body ] diff --git a/tests/background/ref/1.png b/tests/background/ref/1.png index 2c27517..6878e83 100644 Binary files a/tests/background/ref/1.png and b/tests/background/ref/1.png differ diff --git a/tests/background/ref/10.png b/tests/background/ref/10.png index 4b104d9..21a7a73 100644 Binary files a/tests/background/ref/10.png and b/tests/background/ref/10.png differ diff --git a/tests/background/ref/11.png b/tests/background/ref/11.png index 9bd2eaf..49f016f 100644 Binary files a/tests/background/ref/11.png and b/tests/background/ref/11.png differ diff --git a/tests/background/ref/12.png b/tests/background/ref/12.png index 654941e..03473e2 100644 Binary files a/tests/background/ref/12.png and b/tests/background/ref/12.png differ diff --git a/tests/background/ref/13.png b/tests/background/ref/13.png index e37741d..5a7f3fe 100644 Binary files a/tests/background/ref/13.png and b/tests/background/ref/13.png differ diff --git a/tests/background/ref/14.png b/tests/background/ref/14.png index 909c706..5c8ebd2 100644 Binary files a/tests/background/ref/14.png and b/tests/background/ref/14.png differ diff --git a/tests/background/ref/15.png b/tests/background/ref/15.png index 02a46d1..42a77ad 100644 Binary files a/tests/background/ref/15.png and b/tests/background/ref/15.png differ diff --git a/tests/background/ref/16.png b/tests/background/ref/16.png index 0ea6d47..ecccc35 100644 Binary files a/tests/background/ref/16.png and b/tests/background/ref/16.png differ diff --git a/tests/background/ref/2.png b/tests/background/ref/2.png index 50d96a9..eaad761 100644 Binary files a/tests/background/ref/2.png and b/tests/background/ref/2.png differ diff --git a/tests/background/ref/3.png b/tests/background/ref/3.png index 4b8bc45..b6ea8db 100644 Binary files a/tests/background/ref/3.png and b/tests/background/ref/3.png differ diff --git a/tests/background/ref/4.png b/tests/background/ref/4.png index 28181f5..84068b9 100644 Binary files a/tests/background/ref/4.png and b/tests/background/ref/4.png differ diff --git a/tests/background/ref/5.png b/tests/background/ref/5.png index d67d7f8..5b4dd99 100644 Binary files a/tests/background/ref/5.png and b/tests/background/ref/5.png differ diff --git a/tests/background/ref/6.png b/tests/background/ref/6.png index 8aadae6..db34d4c 100644 Binary files a/tests/background/ref/6.png and b/tests/background/ref/6.png differ diff --git a/tests/background/ref/7.png b/tests/background/ref/7.png index 82006bf..21adb12 100644 Binary files a/tests/background/ref/7.png and b/tests/background/ref/7.png differ diff --git a/tests/background/ref/8.png b/tests/background/ref/8.png index 3bcb7bd..e4c10d3 100644 Binary files a/tests/background/ref/8.png and b/tests/background/ref/8.png differ diff --git a/tests/background/ref/9.png b/tests/background/ref/9.png index 34d0337..17e8766 100644 Binary files a/tests/background/ref/9.png and b/tests/background/ref/9.png differ diff --git a/tests/background/test.typ b/tests/background/test.typ index 761f0e8..4369e93 100644 --- a/tests/background/test.typ +++ b/tests/background/test.typ @@ -1,9 +1,8 @@ -#import "/src/lib.typ": catppuccin, flavors, get-flavor, config-code-blocks - #set page(width: auto, height: auto) +#import "/src/lib.typ": catppuccin, flavors, get-flavor, config-code-blocks #let perms = () -#for flavor in flavors.keys() { +#for flavor in flavors.values() { for code-block in (true, false) { for syntax in (true, false) { perms.push((flavor: flavor, code-block: code-block, syntax: syntax)) @@ -15,8 +14,8 @@ show: catppuccin.with(p.flavor, code-block: p.code-block, code-syntax: p.syntax) pagebreak(weak: true) - [ - = #get-flavor(p.flavor).name + block([ + = #p.flavor.name - Code block: #p.code-block - Code syntax: #p.syntax @@ -34,10 +33,10 @@ #for p in perms [ #show: catppuccin.with(p.flavor, code-block: p.code-block, code-syntax: p.syntax) - = #get-flavor(p.flavor).name + = #p.flavor.name == Code block: #p.code-block == Code syntax: #p.syntax ] ``` - ] + ]) } diff --git a/tests/colors/ref/1.png b/tests/colors/ref/1.png index f7b58d5..bf6d801 100644 Binary files a/tests/colors/ref/1.png and b/tests/colors/ref/1.png differ diff --git a/tests/colors/ref/2.png b/tests/colors/ref/2.png index 12a5be9..da60771 100644 Binary files a/tests/colors/ref/2.png and b/tests/colors/ref/2.png differ diff --git a/tests/colors/ref/3.png b/tests/colors/ref/3.png index 4864c6c..2295bb3 100644 Binary files a/tests/colors/ref/3.png and b/tests/colors/ref/3.png differ diff --git a/tests/colors/ref/4.png b/tests/colors/ref/4.png index ce79a31..257c51f 100644 Binary files a/tests/colors/ref/4.png and b/tests/colors/ref/4.png differ diff --git a/tests/colors/test.typ b/tests/colors/test.typ index 6e8310d..c487291 100644 --- a/tests/colors/test.typ +++ b/tests/colors/test.typ @@ -1,6 +1,5 @@ -#import "/src/lib.typ": catppuccin, flavors, get-flavor - #set page(width: auto, height: auto) +#import "/src/lib.typ": catppuccin, flavors, get-flavor #let color-swatches(palette) = { let swatches = () @@ -24,11 +23,8 @@ ) } -#for flavor in flavors.keys() [ - #pagebreak(weak: true) - #show: catppuccin.with(flavor) - - #let palette = get-flavor(flavor) - #color-swatches(palette) -] - +#for flavor in flavors.values() { + pagebreak(weak: true) + show: catppuccin.with(flavor) + color-swatches(flavor) +}