DEV Community

Discussion on: Sharing code examples with Carbon

Collapse
 
itr13 profile image
Mikael Klages • Edited

Though I guess it's based on context, I don't really like images of code, since the text in them can't be selected (not sure if they might also make it harder for blind people using screen readers?).

On the other hand, some websites like twitter don't have support for displaying code, so i can see why it's needed.

Maybe the best would be a combination between gist and carbon, that lets you post both an image and a link to the gist? Or maybe a site that embeds the code as an image in the preview of the link.

Collapse
 
solkimicreb profile image
Miklos Bertalan

This is true. Based on experience Carbon pictures yield a lot higher engagement rate than markdown code snippets or gists though.

I usually use Carbon for cover images and tweets (where I need that click) and stick with real snippets in articles.

Collapse
 
daveskull81 profile image
dAVE Inden

Great points. I will admit that I didn't think about screen readers when I wrote this article which is a whole other issue. It's definitely important to think about the potential audience and how they may need to consume the content. I am also very bad at writing alt text. I never know how much to say. Is it a good idea to have detailed alt text? Is that what folks with screen readers expect? I want to make any content I create here as accessible as possible to folks. Is there any good examples of sites that use alt text well?
I like the idea of using the examples images as cover images / section headings on articles and in tweets. Then in core content of stuff one can embed gists and link out to them as needed.

Thread Thread
 
itr13 profile image
Mikael Klages

I'm not sure to be honest, I remember reading a tweet about how the text should describe only what can be seen in the image, and not additional information that the viewer might not know.

A quick google search led me to this site, in which case I guess code would be "complex information". Maybe a longdesc code pointing at the raw code would work?

Though I don't have any experience with screen readers or helping with accessibility for them, so I don't know how much the different solutions might help, or which ones exist.

Thread Thread
 
daveskull81 profile image
dAVE Inden

That's a good site. I saw a Tweet last night from Jessica Rose asking about wanting information on writing good alt text. Marcy Sutton replied with some great information in this Tweet with links to a webinar about someone using a screen reader and their experience on the internet along with a decision tree for how to decide on what to put in alt text. It looks like some great info.

Collapse
 
bhupesh profile image
Bhupesh Varshney ๐Ÿ‘พ

Yeah that's a cool idea
I tried contacting Dawn Labs ๐Ÿ˜… and suggested to make an api(i would love to make one) so that 3rd party apps could integrate carbon's Feature
But currently they are sticking with the current platform ๐Ÿ™‚

Collapse
 
owl profile image
Oscar

The screen reader concern is valid. The example in the original post will be announced as ยซExample Javascript codeยป. You need to be careful with your alt tags. On platforms such as Medium were you cannot set alt tags the situation for screen reader users is even bleaker.

Overall I think Carbon and similar tools are pretty good for illustrative purposes (think Open Graph or intro images) but are not an option for the core content of a text.