-
Notifications
You must be signed in to change notification settings - Fork 200
Custom Skin (Version 1)
Note: The following applies to Enunciate version 1.x. For applying a custom skin to Enunciate 2, see Custom Skin
Enunciate generates its documentation as follows:
- The object model and associated javadocs are compiled and gathered in memory.
- The documentation is serialized into a single large XML file.
- The XML file is passed through a "transform" to spit out a bunch of HTML documents.
- The HTML documents are copied into a directory along with all the "static" assets (images, css, javascript, etc.). The "static" assets are referred to as the "documentation base".
There are multiple levels of customization that you can leverage when applying a different skin to Enunciate's generated documentation. From simplest-but-least-powerful to most-complex-but-most-powerful, these are:
- Custom CSS stylesheet
- Custom Documentation Base
- Custom Freemarker Transform
You can customize at all three of these levels in one of two ways:
- The Enunciate configuration file
- Classpath lookup, such that you can just include a jar on your Enunciate build classpath and Enunciate will automatically "find" your custom skin.
If you're happy enough with just adjusting some colors and fonts, you can apply your own CSS file to the Enunciate-generated documentation.
<enunciate>
<modules>
<docs css="/path/on/filesystem/to/custom.css"/>
</modules>
</enunciate>
Enunciate will look for a file at /META-INF/enunciate/default.css
on your classpath. If that file is found, it will be used as your custom CSS file.
A "documentation base" is the set of files that are used and referenced by the generated documentation, e.g. images and javascript files.
<enunciate>
<modules>
<docs base="/path/on/filesytem/to/zip/or/dir"/>
</modules>
</enunciate>
Enunciate will look for a file at /META-INF/enunciate/docs-base.zip
on your classpath. If that file is found, it will be used as your custom documentation base.
If you need custom HTML, you will have to provide a custom Freemarker transform that will do what you need. The easiest way to do this probably to start with Enunciate's default Freemarker transform and edit it according to your needs. You'll want to refer to the freemarker guide on XML processing.
<enunciate>
<modules>
<docs freemarkerXMLProcessingTemplate="/path/on/filesytem/to/transform.fmt"/>
</modules>
</enunciate>
Enunciate will look for a file at /META-INF/enunciate/docs.fmt
. If that file is found, it will be used as your custom Freemarker transform.