Carbon: Screenshot shows text highlighting

Created on 3 Oct 2017  ·  3Comments  ·  Source: carbon-app/carbon

If you have some text highlighted on the code snippet it preserves that highlighting when the image is generated.

Not sure if this is desired or not. I unexpectedly generated an image with the highlight when I didn't want it.

Thanks for an awesome resource!

Most helpful comment

If you look at what's actually converting your code into an image

https://github.com/dawnlabs/carbon/blob/de11ff034fe4bc270ddf9550d6d12e3b3a1ba6c2/pages/editor.js#L75-L88

... and

https://github.com/dawnlabs/carbon/blob/de11ff034fe4bc270ddf9550d6d12e3b3a1ba6c2/pages/editor.js#L94-L103

... it merely just picks up your code and converts it to a .PNG image. Internally, it (the 3rd party library, dom-to-image) calls HTMLCanvasElement.toDataURL(), which in turns just returns a data URI.

IMO, I think the text highlight is a good thing, as I would sometimes want to highlight important sections of my code. Whether it was intended or not, I can't quite say. Hope this helps, tho!

All 3 comments

If you look at what's actually converting your code into an image

https://github.com/dawnlabs/carbon/blob/de11ff034fe4bc270ddf9550d6d12e3b3a1ba6c2/pages/editor.js#L75-L88

... and

https://github.com/dawnlabs/carbon/blob/de11ff034fe4bc270ddf9550d6d12e3b3a1ba6c2/pages/editor.js#L94-L103

... it merely just picks up your code and converts it to a .PNG image. Internally, it (the 3rd party library, dom-to-image) calls HTMLCanvasElement.toDataURL(), which in turns just returns a data URI.

IMO, I think the text highlight is a good thing, as I would sometimes want to highlight important sections of my code. Whether it was intended or not, I can't quite say. Hope this helps, tho!

Thanks for the code reference.

I don't mind it either way... but wasn't sure if it was desired or not so figured I'd submit an issue and allow the maintainers to decide.

It wasn't intended, but I'm with @yeskunall in that it can sometimes prove useful. Let's keep it in for now. Thanks for reporting, @vmitchell85, we're glad you like Carbon 👍.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

UlisesGascon picture UlisesGascon  ·  3Comments

hamedmoody picture hamedmoody  ·  4Comments

NSExceptional picture NSExceptional  ·  3Comments

mxstbr picture mxstbr  ·  6Comments

jgierer12 picture jgierer12  ·  5Comments