#1879 Include image in Fandoc documentation

mase Wed 18 Apr 2012

Dear all,

I'm trying to include a local image into my Fandoc documentation but failing. For now the image is stored within the same directory as the Fantom classes. I tried several flavours but none where successful:

  • States
  • States

The Fandoc documentation only mentions images that are stored on the internet.

Images use the same syntax as a hyperlink with anchor text, but are prefixed with a bang: ![fan logo]`http://fantom.org/doc/eximg.png`

fan logo

Example

class Instance 
{
   **
   ** Contains state of Instance. 
   **
   ** The following picture shows the states in which the Instance can reside
   ** ![States]`states.png`
}

NOTE: I don't want to specify the full path to the image since the location in which I checkout my Fantom project can be different eacht time (in theory ;)). Meaning that the path to the image should be relative.

brian Wed 18 Apr 2012

You are creating a pod that has fandoc? If so a good to look is the source code for docLang itself which has an embedded image in the Deployment chapter. Basically you just need to place the png file in the same directory as the documentation (by convention doc/) and then ensure it is packaged up in your pod zip file in your build script with the resDirs field:

resDirs = [`doc/`]

mase Wed 18 Apr 2012

Hi Brian,

No I'm not trying to write fandoc. I was referring to the documentation that you can append to classes/methods in the fan files. I wan't to include a picture in the description of a method showing the states that can be set via the method.

brian Wed 18 Apr 2012

Okay - I've never done that, but I believe same principle should apply and it should work. Although I might have to tweak doc compiler for that case

Stick your image in a directory called doc/ and add make sure it is added to your pod in your build file:

resDirs = [`doc/`]

Then in your fandoc you should be able to reference image like this:

![caption]`myimage.png`

If it doesn't work, then email me at [email protected] a zip of your pod source I'll debug

mase Thu 19 Apr 2012

Hi Brian,

It ain't working so forwarded you an example project.

Thanks for the help already

Login or Signup to reply.