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:
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. (GPLv2 licence)
f90doc:
A simple documentation tool for Fortran 90 that outputs HTML pages. (MIT licence)
f90tohtml:
A Perl script that converts Fortran 90 source code to HTML and creates a clickable calling tree. (MIT licence)
FORD
An automatic documentation generator for modern Fortran (> 90), written in Python. Offers LaTeX support, on-line search, syntax highlighting, and custom style sheets. Uses Markdown for formatting. (GPLv3)
FortranDOC:
A Fortran 95 program for source code documentation, with LaTeX output. It also features a graphical user interface. (GPLv3 licence)
ROBOdoc:
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. (GPLv3 licence)
SphinxFortran:
Fortan 90 extension for the Python documentation generator Sphinx. Depends on the Python packages sphinx and numpy. (CeCILL licence)

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 name 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