Injecting images to text file


Is it possible to override rendering to show images inside a text file? I want to comment a complex c++ code with a pictures. Something like

For example original c++

void SomeFunction()
    // Some comment
    int a = 1;

   // Some comment
   // ![](Images/cat.png)
   int b = a + 1;

will be show as


Ofc when I remove line // ![](Images/cat.png) image also will stop rendering.


It’s possible; the hydrogen package does this for things like Python (I believe).

As to how it’s done, I suggest starting by looking at the hydrogen source code (because I have no idea personally).