As mentioned in the best practices, it is not advised to modify the default templates provided with HelpNDoc usually located in the program files directory. Furthermore, some templates might need only subtle changes to a subset of the files to be suit the requirements. That's why HelpNDoc introduces the template inheritance concept where a template can "inherit" from a parent template, thus using all its template files, and only override the required files.
Inheriting from a parent template
From the final children template, just add the "inherits" key in the template.info file's "config" section and mention the parent template's name as the value. As an example:
[config]
name=Child template
category=HTML Documentation
extension=html
inherits=Default HTML Template
This configuration file instructs HelpNDoc to use the template named "Default HTML Template" as the parent template. Only template files from the same documentation format can be used as a parent template.
Overriding a template file
To change the content a file, just place a file with the same name in the same directory withing the child template. HelpNDoc will use this file instead of the parent template one. As an example, if the parent template contains the file "index.pas.html" it is possible to override this file by creating a file names "index.pas.html" in the child template with alternative content.
How is it working
At generation time, HelpNDoc reads the template selected for the project. If that template inherits from a parent template, HelpNDoc will first generate a new temporary template as follows:
Limitations
Some limitations apply to the template inheritance feature: