Source Code Documentation

The documentation of source code is an important part of modern software development. Many tools for automatic source code documentation are available for Fortran projects:

Doxygen (GPLv2)
A popular documentation generator that supports several programming languages, among them Fortran. Doxygen allows pretty printing, call graph generation, man page generation, as well as output to LaTeX and HTML.
f90doc (MIT)
A simple documentation tool for Fortran 90 that outputs HTML pages.
f90tohtml (MIT)
A Perl script that converts Fortran 90 source code to HTML and creates a clickable calling tree.
FORD (GPLv3)
An automatic documentation generator for modern Fortran (> 90), written in Python. Offers LaTeX support, online search, syntax highlighting, and custom style sheets. Uses Markdown for formatting.
FortranDOC (GPLv3)
A Fortran 95 program for source code documentation, with LaTeX output. It also features a graphical user interface.
ROBOdoc (GPLv3)
ROBOdoc is a documentation tool for various programming languages, including Fortran. For each block (function, subroutine, derived type, …) a specially formatted header must be written. The output format can be set to HTML, LaTeX, ASCII, XML DocBook, or RTF.
SphinxFortran (CeCILL)
Fortan 90 extension for the Python documentation generator Sphinx. Depends on the Python packages sphinx and numpy.

FORD

The documentation generator FORD is based on Python 3. It can be installed into a virtual environment using venv and pip:

$ python3 -m venv virtual-environment/
$ source virtual-environment/bin/activate
$ python3 -m pip install ford

In order to use FORD, a project file has to be written at first. Save a basic Markdown file project.md in your workspace directory:

project:            Super Cool Fortran Project
summary:            A brief description of my project.
author:             Margaret Hamilton
author_description: I program things in Fortran.
date:               October 2, 2018
project_website:    https://supercoolfortranproject.org/
project_github:     https://github.com/example/fortranproject

This is the first paragraph of the document.

Please see the project’s wiki for details. Run the FORD compiler inside your project directory:

$ ford project.md -d ./src

The project file named project.md and the source code path ./src are given as arguments. By default, the documentation will be saved to directory ./doc. Open the HTML file ./doc/index.html inside your browser.

References