Skip to content
Ryan Heaton edited this page Oct 30, 2015 · 5 revisions

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

Applying a Custom Skin to Enunciate's Documentation

Enunciate generates its documentation by passing the data model provided by the "provider" modules (see Modules) through a Freemarker Template, which is used to write out the HTML files to a directory. After the HTML files are generated, Enunciate copies a set of "static assets" (images, css, javascript, etc.) into the directory. The set of static assets is 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:

  • Replace the default CSS stylesheet.
  • Provide additional CSS stylesheet(s).
  • Provide a custom documentation base.
  • Provide a custom Freemarker template.

Each of these customization points can be provided 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(s) to the Enunciate-generated documentation.

Custom CSS Via Enunciate Configuration File

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

Custom CSS Via Classpath Lookup

Enunciate will look for a file at /META-INF/enunciate/css/style.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 template and edit it according to your needs. You'll want to refer to the Freemarker docs.

You may be interested in the directory of custom themes to browse themes the community has contributed. And please feel free to contribute your own.

Custom Freemarker Transform Via Enunciate Configuration File:

<enunciate>
 <modules>
   <docs freemarkerTemplate="/path/on/filesytem/to/template.fmt"/>
 </modules>
</enunciate>
Clone this wiki locally