diff --git a/demo-tabs.tsx b/demo-tabs.tsx index 6bc1df99a..a1ec9164a 100644 --- a/demo-tabs.tsx +++ b/demo-tabs.tsx @@ -24,7 +24,7 @@ export function Demo() { onChange={e => setHello(e.target.value || null)} data-interacted={Boolean(hello)} /> -

Hello, {hello || 'anonymous visitor'}!

+

Hello, {hello || 'anonymous visitor'}!

) } diff --git a/packages/docs/src/app/(pages)/_landing/demo.client.tsx b/packages/docs/src/app/(pages)/_landing/demo.client.tsx index 1222c33a8..5257cbca8 100644 --- a/packages/docs/src/app/(pages)/_landing/demo.client.tsx +++ b/packages/docs/src/app/(pages)/_landing/demo.client.tsx @@ -25,7 +25,9 @@ export function Demo() { onChange={e => setHello(e.target.value || null)} data-interacted={Boolean(hello)} /> -

Hello, {hello || 'anonymous visitor'}!

+

+ Hello, {hello || 'anonymous visitor'}! +

) } diff --git a/packages/docs/src/app/(pages)/_landing/demo.tsx b/packages/docs/src/app/(pages)/_landing/demo.tsx index 567239e34..2711951d0 100644 --- a/packages/docs/src/app/(pages)/_landing/demo.tsx +++ b/packages/docs/src/app/(pages)/_landing/demo.tsx @@ -1,5 +1,6 @@ import { CodeBlock } from '@/src/components/code-block' import fs from 'node:fs/promises' +import { format } from 'prettier' import { Suspense } from 'react' import { Demo } from './demo.client' @@ -7,13 +8,15 @@ export async function LandingDemo() { const demoFilePath = process.cwd() + '/src/app/(pages)/_landing/demo.client.tsx' const demoFile = await fs.readFile(demoFilePath, 'utf8') + // Poor man's AST manipulation const demoCode = demoFile + .replace(/className=".+"/g, '') // Strip styling .split('\n') - .filter( - line => - !line.includes('className="') && !line.includes('data-interacted=') - ) + .filter(line => !line.includes('data-interacted=')) .join('\n') + const formattedCode = await format(demoCode, { + parser: 'typescript' + }) return ( <> - + ) }