How to add images to the documentation of Perl modules on CPAN
Having a lot of clear documentation for a CPAN module is awesome, but looking at a wall of text while reading it can be a bit boring.
Luckily both MetaCPAN and search.cpan.org.
First let's link to few examples:
Including images in MetaCPAN
Including images on search.cpan.org
As Ether pointed out on the related blogs.perl.org post, grep.cpan.me can list a bunch of modules that might have some embedded HTML in their POD.
So how can this be done?
Let's look at the source code of Char::Clicker.
It has the following section:
=begin HTML <p><img src="http://gphat.github.com/chart-clicker/static/images/examples/line.png" width="500" height="250" alt="Line Chart" /></p> =end HTML
That's all we need to include in the POD of the module.
The images are served from a Github page.
Actually Chart::Clicker has its own site hosted on a Github page. It is very easy to create such a Github page for your project. Just follow the instructions. There you can include add the images
In the source code of SVG the example is slightly different:
=for HTML <p><img src="https://szabgab.com/img/SVG/circle.png" alt="SVG example circle" /></p>
Here the image is actually served from my own personal domain.
Published on 2013-08-22