Skip to content

Custom Skin (Version 1)

Ryan Heaton edited this page Jan 11, 2017 · 3 revisions

Note: The following applies to Enunciate version 1.x. For applying a custom skin to Enunciate 2, see Custom Skin

Applying a Custom Skin to Enunciate's Documentation

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.

Custom CSS stylesheet

If you're happy enough with just adjusting some colors and fonts, you can apply your own CSS file to the Enunciate-generated documentation.

Custom CSS Via Enunciate Configuration File

<enunciate>
 <modules>
   <docs css="/path/on/filesystem/to/custom.css"/>
 </modules>
</enunciate>

Custom CSS Via Classpath Lookup

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.

Custom Documentation Base

A "documentation base" is the set of files that are used and referenced by the generated documentation, e.g. images and javascript files.

Custom Docs Base Via Enunciate Configuration File

<enunciate>
 <modules>
   <docs base="/path/on/filesytem/to/zip/or/dir"/>
 </modules>
</enunciate>

Custom Docs Base Via Classpath Lookup

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.

Custom Freemarker Transform

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.

Custom Freemarker Transform Via Enunciate Configuration File:

<enunciate>
 <modules>
   <docs freemarkerXMLProcessingTemplate="/path/on/filesytem/to/transform.fmt"/>
 </modules>
</enunciate>

Custom Freemarker Transform Via Classpath Lookup

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.

Clone this wiki locally