How to Generate Documentation from Delphi Source Code

If you have ever read Getting Started with Documentation Insight, you should know how to browse and document source code in Delphi. In this tutorial, let’s see how to use Documentation Insight Enterprise version to produce rich documentation files with only a few steps.

1. Open an existing project or a project group in RAD Studio

2. Click the menu DocumentationGenerate Documentation…

Documentation Insight will find the corresponding documentation project (.diproj file type) in the same location of the current project (or group). A default documentation project will be created if not found. You may also click the New Project to create a new empty documentation project or use Open Project to open an existing project.

3. We will see some basic information in the first page:

4. By default, all current source code projects opened in the IDE will be added into the documentation project, you may add or remove any project.

5. In the next step, we can customize the header and footer template. If we would like to generate documentation for code elements in the implementation section, just check the first option.

Note: The templates must be valid. You may use the following variables: <%TopicTitle%>, <%Title%>,<%Author%>,<%Summary%>,<%Comment%>,<%Copyright%>

6. Publish options
At last, we may choose the output documentation types and their corresponding location. The locations are relative to current documentation project.

To generate a Microsoft Help V2.x (Single HxS file) file, you require Microsoft Help 2 Compiler which is distributed with Visual Studio 2003-2008.

Finally, just click the Generate button, Documentation Generator will compile the source projects and produce various documentation files for you.

Tick, tick, tick… It Succeeded!

Here lists all results in the generation process.
You may click the hyperlinks to explore the generated artifacts:

* Web pages

Default page

The Index tab
We use a lightweight local server (Help & Manual H2 Go) to preview html files as some web browsers have restrictions for local web pages.

Online Documentation Sample

* CHM file

* Microsoft Help 2 file
When you click the hyperlink of MSHelp2 file (Single .HxS file), the file will be automatically registered and Documentation Insight will use Microsoft Documentation Explorer (dexplore.exe) to browse the help file.

The help file will be automatically integrated into your local RAD Studio Documentation (2005-XE2).

* Help & Manual

Help & Manual is a well-known help authoring software. Documentation Insight can extract documentation from your source code and generate H&M files so that you may merge it into your own H&M project. Then you can customize the template in H&M and publish them together to produce uniform help files and deliver to your customers. (H&M also supports various formatting e.g. Web page, CHM, PDF, RTF, E-Books.)

Applying a H&M skin and publish to a CHM file like this:

Once the H&M project file was generated, Documentation Insight only updates the project information (Title, Author, Copyright) while all API documentation topics in the H&M project will be overwritten without any confirmation. You should not edit the generated topics in H&M otherwise your changes will be lost.

Can’t wait to generate documentation? Try Documentation Insight!