Code blocks with Ruby hash access (hash[:key]) cause UnoCSS errors
Describe the bug
Code blocks embedded in presentations will somewhat frequently for me (Ruby code) cause UnoCSS to malfunction. Here's an example change that I had to make to a code block because p[:external_id] was causing it to invent a padding utility, causing the presentation not to compile (with an error message that does not point back to this line of code)
- "external_id" => p[:external_id],
+ "external_id" => payload[:external_id],
The error looks like this:
11:02:05 AM [vite] Internal server error: [postcss] /__uno.css:15:28: Double colon
Plugin: vite:css
File: /__uno.css:15:27
13 | .gap-2{gap:0.5rem;}
14 | [b=""]{border-width:1px;}
15 | .p\[\:attributes\]{padding::attributes;}
| ^
16 | .p\[\:device\]{padding::device;}
17 | .px-4{padding-left:1rem;padding-right:1rem;}
at Input.error (/Presentations/node_modules/.pnpm/[email protected]/node_modules/postcss/lib/input.js:135:16)
at Parser.doubleColon (/Presentations/node_modules/.pnpm/[email protected]/node_modules/postcss/lib/parser.js:301:22)
at Parser.colon (/Presentations/node_modules/.pnpm/[email protected]/node_modules/postcss/lib/parser.js:159:16)
at Parser.checkMissedSemicolon (/Presentations/node_modules/.pnpm/[email protected]/node_modules/postcss/lib/parser.js:123:22)
at Parser.decl (/Presentations/node_modules/.pnpm/[email protected]/node_modules/postcss/lib/parser.js:296:12)
at Parser.other (/Presentations/node_modules/.pnpm/[email protected]/node_modules/postcss/lib/parser.js:401:18)
at Parser.parse (/Presentations/node_modules/.pnpm/[email protected]/node_modules/postcss/lib/parser.js:472:16)
at parse (/Presentations/node_modules/.pnpm/[email protected]/node_modules/postcss/lib/parse.js:11:12)
at new LazyResult (/Presentations/node_modules/.pnpm/[email protected]/node_modules/postcss/lib/lazy-result.js:165:16)
at Processor.process (/Presentations/node_modules/.pnpm/[email protected]/node_modules/postcss/lib/processor.js:53:14)
Minimal reproduction
Make a presentation with the following ruby code in it:
p[:external_id]
Environment
- Slidev version:
"@slidev/cli": "^52.6.0", - Browser: any
- OS: any
If you are using Slidev globally (i.e. npx slidev or npm i -g slidev), please try to reproduce the issue in a local project (i.e. npm create slidev@latest).
Looks like an UnoCSS issue. Slidev won't exclude code block contents from the UnoCSS input to avoid unnecessary complexity. Could you help find/open an issue in UnoCSS's repo?
Ah ok I was afraid of that but didn't dig deep enough into how slidev worked to be able to figure that out. Yeah I can do that 👍