joncfoo

Offline documentation for F#

Posted on 2016-01-19

.NET/Mono API docs

The base system APIs are available to view offline with monodoc. Simply fire it up and you can view the documentation in the app.

Notes:

Why are the docs in an application? Couldn’t they just be HTML files someplace?

F# Core API docs

All the documentation I’ve found so far on F# is online. I was wondering if there was a way to get offline API documentation similar to what Haddock or Javadoc produce.

My search for official offline API documentation for F# from Microsoft was met with limited success. I came across Visual Studio X Help Downloader but couldn’t find its couterpart “Microsft Help Viewer” offered anywhere as a download.

A few more searches later I came across this post and this blog entry.

mdoc to the rescue.

First I had to find out where the FSharp.Core.dll and FSharp.Core.xml files lived.

dpkg -L libfsharp-core4.3-cil produced a wonderful list of files installed by that package and I found the paths.

Time to invoke mdoc.

mdoc update -o documentation \
  -i /usr/lib/cli/FSharp.Core-4.3/4.1/FSharp.Core.xml \
  /usr/lib/cli/FSharp.Core-4.3/4.1/FSharp.Core.dll \
  --exceptions=added

mdoc export-html -o htmldocs documentation

Now I had index.html in the htmldocs folder which contained the API docs for F# Core Library.

Hooray.

P.S. the language specification can be found here as a PDF - also useful to have.

Notes:

Why aren’t the F# docs automatically generated in the format that monodoc expects & put in the right place? - mdoc can generate this.

Is there official guide somewhere showing how to generate docs from assemblies?

Is this something Paket could handle? i.e. generate offline docs if instructed to for all the dependencies it manages. Other apps that also manage dependencies like maven & cabal have options to grab/generate the docs and sources as well.