carbon-app / carbon

:black_heart: Create and share beautiful images of your source code
https://carbon.now.sh
MIT License
34.29k stars 1.9k forks source link

Screenshot formatting is broken for hanging indent code #1495

Open aidansunbury opened 9 months ago

aidansunbury commented 9 months ago

Describe the bug When writing code with hanging indents (first line is at the margin, subsequent lines are indented), the screenshot exports are not formatted in the same way as they appear in the carbon editor.

This may also just be an issue with the editor frame not wrapping code when it should. Making the editor frame slightly wider normally fixes the issue.

To Reproduce Write any code in the editor using hanging indents and export it. I tested that both the copy to clipboard and the download image exports were broken.

Screenshots

Screenshot 2023-09-20 at 2 25 50 PM

View in Editor

image

Exported image

zach28attack commented 9 months ago

I would like to work on this. If possible please assign me.

mxschmitt commented 3 months ago

I can repro, e.g.:

import { expect, test } from '@nuxt/test-utils/playwright'

test.use({
  nuxt: {
    rootDir: fileURLToPath(new URL('..', import.meta.url))
  }
})

test('test', async ({ page, goto }) => {
  await goto('/', { waitUntil: 'hydration' })
  await expect(page.getByRole('heading')).toHaveText('Welcome to Playwright!')
})

produces:

carbon (3)