Dont put your code snippet as an image

Code snippets no matter the placement as seen as a guide, answer or ways to do something. From a blog to a website, Gist they serve the same purpose. Code snippets arent some secrecy that can’t be shared or must not be copied if the were then why would you even reveal it to begin with.

Yet still you visits websites that will put code snippets in an image, completely useless and missing the point. Code is text it’s not an image, it is something that can be selected, altered and copied. What is someone meant to do with an image if your code is meant to teach something?

How about this

code as image yuck
code as image

or this?

<?php
   $val = "secret";
   echo "Pre-hash string: $val <br />";
   $hash_val = md5 ($val);
   echo "Hashed outcome: $hash_val";
?>

Depending on how you get the image created the inline code sits better, more customizable and as I have stated can actually be used.

The darn code snippet images make debugging harder too, just put it in a syntax highlighter box. You will get better SEO if your code is readable by Google especially if it’s for a problem.

The only place that an image code snippet is ok is Twitter BUT even then its pretty close to useless. Just link to a Gist no one can do anything with a jpg that has code.

Maybe some think its fancy or trendy whatever the thought should be put to rest, its 2019 code shouldnt be turned into images.