Insert a picture in code comment via Emacs

comments, editor, emacs

Solution

Take a look at `iimage-mode`: it is a standard solution to display an image in a text buffer.

For example, given the following file:

/* an image is worth a thousand words:
 * <path/to/image.png>
 */
int main (int argc, char **argv) {
  return 0;
}

then running M-x`turn-on-iimage-mode` should display `image.png` in place of its path.

However, I agree with @user4815162342's comment that you need to distribute images along with source files and to remember updating them when needed (it is sometimes hard to update code comments when they are text only; it will IMO be harder to update image comments)

Problem

An idea has just came to my mind. Is there any methods to insert a picture in code comment to help explain our code? After all, a picture is worth a thousand words. Since I use Emacs, is there any implementations for Emacs so far?

Original source

Related problems