While working on GH Candle’s documentation, I thought it would be nice to have a slick animation with a gif. However, I genuinely didn’t want to add images to the tool’s git history, so I looked for alternatives, and luckily I found some. This entry elaborates on how I used GH gist for this.
First, I’ll share the approaches that did not work:
- Adding PNGs as base64 data is not supported by the GH Markdown parser.
- Adding non-SVG images to the git history will always be handled as binary.
- Technically, you could force git to take images as plain text through gitattibutes, but it does not make sense since most of those are bitmaps, ergo binaries.
- Generate a Personal Access Token with “gist” permission
- Clone the gist using its HTTPS URL
- Yes, each GH gist is a git repository
- Add the image to the gist repository.
- Push these changes using your GH username and the GH PAT you generated at the beginning
- You are done. Now you only need to copy the image URL and use it on the documentation.
Last modified on 2022-10-23