Injecting images to text file


#1

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 https://marketplace.visualstudio.com/items?itemName=VisualStudioProductTeam.ImageInsertion

For example original c++

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

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

will be show as

1

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


#2

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).