Using the code formatting stylesheet
This page contains comprehensive information about using the javadoc.css stylesheet for Apache Juneau JavaDoc documentation.
Overview
The javadoc.css file is located at docs/src/javadoc/javadoc.css and provides comprehensive styling for all generated JavaDoc HTML pages. It includes both standard JavaDoc styles and extensive Juneau-specific customizations for enhanced documentation presentation.
Configuration
The stylesheet is automatically configured in the root pom.xml file for the Maven Javadoc plugin:
<stylesheetfile>${maven.multiModuleProjectDirectory}/docs/src/javadoc/javadoc.css</stylesheetfile>
This ensures that all generated JavaDoc HTML files use the custom stylesheet when running:
mvn javadoc:javadocmvn site
Standard JavaDoc Styles
The stylesheet includes comprehensive styling for standard JavaDoc elements:
Typography
- Fonts: Uses DejaVu Sans for body text, DejaVu Sans Mono for code
- Base font size: 14px
- Headings: H1 (20px) through H6 (13px) with appropriate sizing
Navigation
- Top navigation bar: Blue background (#4D7A97) with white text
- Sub-navigation: Light gray background (#dee3e9)
- Active page indicator: Orange highlight (#F8981D)
- Responsive design: Mobile-friendly navigation with collapsible menu
Tables
- Summary tables: Alternating row colors (white and #EEEEEF)
- Table tabs: Interactive tabs for switching between different views
- Responsive columns: Grid-based layouts that adapt to screen size
Links
- Standard links: Blue (#4A6782) with orange hover (#bb7a2a)
- External links: Automatically marked with an external link icon
- No underlines: Clean link styling without default underlines
Juneau-Specific Custom Styles
Code Highlighting Tags
The stylesheet provides extensive inline code highlighting tags for syntax coloring:
Java Code Tags
<jc>- Java comment (green)<jd>- Javadoc comment (#3f5fbf)<jt>- Javadoc tag (#7f9fbf, bold)<jk>- Java keyword (#7f0055, bold)<js>- Java string (#00B)<jf>- Java field (DarkBlue)<jsf>- Java static field (DarkBlue, italic)<jsm>- Java static method (italic)<ja>- Java annotation (grey)<jp>- Java parameter (#654040)<jv>- Java local variable (#654040)
XML Code Tags
<xt>- XML tag (DarkCyan)<xa>- XML attribute (purple)<xc>- XML comment (mediumblue)<xs>- XML string (#00B, italic)<xv>- XML value (black)
Other Code Tags
<mk>- Manifest file key (DarkRed, bold)<mv>- Manifest file value (DarkBlue)<cc>- Config file comment (green)<cs>- Config file section (DarkRed, bold)<ck>- Config file key (DarkRed)<cv>- Config file value (DarkBlue)
Code Block Classes
.bcode,.bjava,.bjson,.bxml,.bini,.buon,.burlenc,.bconsole,.bschema- Bordered code blocks with left border and background.code- Unbordered code block
Example:
<p class='bjava'>
<jk>public static void</jk> myMethod(<jk>int</jk> <jv>foo</jv>, String <jv>bar</jv>) {
System.<jsm>out</jsm>.println(<js>"Hello world!"</js>);
}
</p>
Special Classes
Topic Headers
h2.topic,h3.topic,h4.topic,h5.topic- Styled topic headers with borders and background gradients- Automatically includes a decorative icon
Tables
table.styled- Table with alternating row colors and styled borderstable.unstyled- Plain table with borders but no row coloringtable.borderless- Table without borderstable.plain- Table with plain borderstable.striped- Table with striped rows
Lists
ul.toc,ol.toc- Table of contents with styled backgroundul.spaced-list,ol.spaced-list- Lists with extra spacing between itemsul.javatree,ol.javatree- Java class hierarchy lists with special markersul.seealso- "See Also" lists with automatic labelul.notes- Notes lists with automatic labelul.values- Values lists with automatic labelul.format- Format lists with automatic label
Alert Blocks
div.info- Information block (blue border, light blue background)div.warn- Warning block (orange border, light orange background)div.severe- Severe warning block (red border, light red background)p.severe,p.warn,p.info,p.todo- Paragraph-level alerts
Special Elements
.bordered- Adds border around images or blocks.fixedWidth- Forces block to be 800px widea.doclink- Styled link to documentation with dotted underline<l>- Literal text tag<review>- Review marker block (yellow background)<reviewed>- Reviewed marker block (green background)
Width Utilities
.w400- 400px width.w500- 500px width.w800- 800px width.w900- 900px width.w1000- 1000px width
Java Hierarchy Markers
Special list item classes for displaying Java class hierarchies:
li.jc- Java class (green circle)li.jac- Java abstract class (yellow circle)li.jic- Java interface (purple diamond)li.ja- Java annotation (cyan circle)li.je- Java enum (brown circle)li.jf- Java field (green circle)li.jm- Java method (green circle)li.jp- Java package (orange circle)
Usage Examples
Code Blocks with Syntax Highlighting
/**
* Example method with highlighted code.
*
* <p class='bjava'>
* <jk>public</jk> <jk>void</jk> processData(<jk>String</jk> <jv>input</jv>) {
* <jc>// Process the input</jc>
* System.<jsm>out</jsm>.println(<js>"Processing: "</js> + <jv>input</jv>);
* }
* </p>
*/
Styled Tables
/**
* Configuration options:
*
* <table class='styled'>
* <tr><th>Option</th><th>Description</th></tr>
* <tr><td>option1</td><td>First option</td></tr>
* <tr><td>option2</td><td>Second option</td></tr>
* </table>
*/
Alert Blocks
/**
* <div class='warn'>
* <b>Warning:</b> This method may throw an exception.
* </div>
*
* <div class='info'>
* <b>Note:</b> This feature was added in version 9.0.
* </div>
*/
Topic Headers
/**
* <h3 class='topic'>Advanced Usage</h3>
*
* This section covers advanced usage patterns.
*/
Java Hierarchy
/**
* Class hierarchy:
* <ul class='javatree'>
* <li class='jp'>com.example</li>
* <li class='jc'>BaseClass</li>
* <li class='jc'>MyClass extends BaseClass</li>
* </ul>
*/
Customization
To customize the JavaDoc appearance:
- Edit the
docs/src/javadoc/javadoc.cssfile - Regenerate the JavaDoc documentation:
or
mvn javadoc:javadocmvn site
Changes will be reflected in all generated JavaDoc pages.
Responsive Design
The stylesheet includes comprehensive responsive design support:
- Mobile navigation with collapsible menu
- Responsive table layouts that adapt to screen size
- Flexible grid systems for multi-column layouts
- Optimized typography for different screen sizes
Color Scheme
The stylesheet uses a consistent color palette:
- Primary blue: #4D7A97 (navigation, links)
- Orange accent: #F8981D (active states, highlights)
- Hover orange: #bb7a2a (link hovers)
- Light gray: #dee3e9 (backgrounds, borders)
- Dark text: #353833 (body text)
- Dark blue: #2c4557 (headings)
Additional Resources
For more information, see:
Share feedback or follow-up questions for this page directly through GitHub.