carbon-app / carbon

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

SVG export not loading in InkScape correctly #1458

Open CalvinWilkinson opened 1 year ago

CalvinWilkinson commented 1 year ago

Describe the bug

When exporting as a .svg file and opening it in InkScape, InkScape shows nothing. The file does indeed have data in it. I do not get any errors or anything when loading it in InkScape either.

When selecting the file in windows explorer on windows, the preview pane on the right renders it just fine. Is this a compatibility issue between the xml data output in the file and what InkScape possibly can read?

To Reproduce

Steps to reproduce the behavior:

  1. Create any type of code snippet in carbon
  2. Export as .svg
  3. Open in InkScape
  4. Observe that inkscape shows nothing.

Expected behavior

Expected to open the generated .svg file and see the image, not a blank canvas.

Screenshots

Window Explorer Preview Pane image

Info (please complete the following information):

Default snipped used . . .

Code snippet
const pluckDeep = key => obj => key.split('.').reduce((accum, key) => accum[key], obj)

const compose = (...fns) => res => fns.reduce((accum, next) => next(accum), res)

const unfold = (f, seed) => {
  const go = (f, seed, acc) => {
    const res = f(seed)
    return res ? go(f, res[1], acc.concat([res[0]])) : acc
  }
  return go(f, seed, [])
}