Managing Project Documentation

Managing Project Documentation

Fossil provides a built-in wiki that can be used to store the documentation for a project. This is sufficient for many projects. If your project is well-served by wiki documentation, then you need read no further.

But fossil also supports embedding project documentation as files in the source tree. There are several potential advantages to this approach:

  1. The documentation files are versioned together with the source code files so it is always clear what version of the documentation goes with a particular release.
  1. The documentation files can be edited using your favorite text editor instead of having to use the web-based wiki editor.
  1. Only people with check-in privileges can modify the documentation. (This might be either an advantage or disadvantage, depending on the nature of your project.)

We will call documentation that is included as files in the source tree "embedded documentation".

Fossil Support For Embedded Documentation

The fossil web interface supports embedded documentation using the "/doc" page. To access embedded documentation, one points a web browser to a fossil URL of the following form:


The <baseurl> is the main URL used to access the fossil web server. For example, the <baseurl> for the fossil project itself is either or If you launch the web server using the "fossil server" command line, then the <baseurl> is usually http://localhost:8080/.

The <version> is any unique prefix of the check-in ID for the check-in containing the documentation you want to access. Or <version> can be the name of a branch in order to show the documentation for the latest version of that branch. Or <version> can be one of the keywords "tip" or "ckout". The "tip" keyword means to use the most recent check-in. This is useful if you want to see the very latest version of the documentation. The "ckout" keywords means to pull the documentation file from the local source tree on disk, not from the any check-in. The "ckout" keyword normally only works when you start your server using the "fossil server" or "fossil ui" command line and is intended to show what the documentation you are currently editing looks like before you check it in.

Finally, the <filename> element of the URL is the full pathname of the documentation file starting from the root of the source tree.

The mimetype (and thus the rendering) of documentation files is determined by the file suffix. Fossil currently understands 192 different file suffixes, including all the popular ones such as ".css", ".gif", ".htm", ".html", ".jpg", ".jpeg", ".png", and ".txt".

Documentation files whose names end in ".wiki" use the same markup as wiki pages - a safe subset of HTML together with some wiki rules for paragraph breaks, lists, and hyperlinks. The ".wiki" and ".txt" pages are rendered with the standard fossil header and footer added. All other mimetypes are delivered directly to the requesting web browser without interpretation, additions, or changes.


This file that you are currently reading is an example of embedded documentation. The name of this file in the fossil source tree is "www/". You are perhaps looking at this file using the URL:

The first part of this path, the "", is the base URL. You might have originally typed: The web server at the site automatically redirects such links by appending "index.html". The "index.html" file on is really a CGI script (do not be mislead by the name) which runs the fossil web service in CGI mode. The "index.html" CGI script looks like this:

repository: /fossil/fossil.fossil

This is one of three ways to set up a fossil web server.

The "/tip/" part of the URL tells fossil to use the documentation files from the check-in that was checked in most recently. If you wanted to see an historical version of this document, you could substitute the name of a check-in for "/tip/". For example, to see the version of this document associated with check-in [9be1b00392], simply replace the "/tip/" with "/9be1b00392/". You can also substitute the symbolic name for a particular version or branch. For example, you might replace "/tip/" with "/trunk/" to get the latest version of this document in the "trunk" branch. (As of this writing, the self-hosting fossil repository only has a single branch "trunk" and so "trunk" and "tip" amount to the same thing, but they would be different in a project with multiple branches.)

The file that encodes this document is stored in the fossil source tree under the name "www/" and so that name forms the last part of the URL for this document.

As I sit writing this documentation file, I am testing my work by running the "fossil server" command line and viewing http://localhost:8080/doc/ckout/www/ in Firefox. I am doing this even though I have not yet checked in the "www/" file for the first time. Using the special "ckout" version identifier on the "/doc" page it is easy to make multiple changes to multiple files and see how they all look together before committing anything to the repository.