Including generated gif files in the documentation

documenter

#1

Hi,

We are having problems to include in the documentation of TaylorIntegration.j some .gif files that are generated by the documentation (using Plots.jl); see https://perezhz.github.io/TaylorIntegration.jl/latest/root_finding.html, which does not display two gif files.

We first tried to display them directly, as we would do for (generated) figure. We also tried copying the generated gif file to the build directory. None of these methods work, though both solutions are properly displayed locally.

Thanks in advance!


#2

I’ve had no problems, treating animated GIF files exactly the same as PNGs and JPGs. I can create them beforehand, or have them created as part of the Documenter run: in the MarkDown source, I can save newly-created files into the docs/src/assets/ hierarchy:

```@example
   ...
   pathname="assets/figures/testanimation.gif")
   ...

`` ` 

![gif example](assets/figures/testanimation.gif)

I remember getting the paths right took a little bit of trial and error…


#3

Thanks a lot for the tip! I will try that!


#4

Sorry for insisting, can you provide more details or a link? I haven’t been able to work it out.

For completeness, this is the @example block we have

@example
   anim1 = @animate for i=1:20
       ...
   end
   gif(anim1, "anim1.gif", fps = 2)

I’ve tried with no success to include pathname inside the gif() clause when saving the animation, or saving it in the build/assets directory, which throws an error.


#5

Hmm… I don’t use Plots, but I just installed it and it seems to work out of the box, the way you’d expect:

Note, you can’t save into the build/ folder, because that’s deleted each time you start the Documenter run. I assume that it looks in the docs/src/ folder.


#6

Thanks for looking into this.

I agree that the gif is created properly. The generation of the docs works fine on my local machine; the problem appears when the documentation is generated by travis.

I noticed that the gif files are (locally) saved in the build/ directory, but they do not make it into the gh-pages branch. Maybe the simplest solution is to save the gifs (statically) so they are in the repo, and link the displayed animation to those files.

Thanks for the help!