Reputation: 9584
I've discovered that I can add some CSS styling to Javadocs in Eclipse, to create some nice effects for the inline code hovers.
Sample javadoc:
/**
* <p>This is a general description of the class.<p>
*
* <p>Here is a useful direct quote:</p>
*
* <div style="background-color:white; border: 1px solid gray; margin: 1em 2.5em; padding: 0em 0.5em">
* <p>This quote has a list:</p>
* <ul>
* <li>Item 1</li>
* <li>Item 2</li>
* </ul>
* </div>
*
*/
public class SSCCE {
}
Sample result:
I'd like to take advantage of this more in my code, but it would be much better if I could use something like <div class="box">
instead of setting the style attribute manually, for the following reasons:
Is it possible to do this in Eclipse, perhaps with a plugin?
Upvotes: 5
Views: 2368
Reputation: 9584
Through experimentation I discovered I could link to a stylesheet using a <link>
tag with an href
relative to the .java file location. This does address issue #1 mentioned in the question, but personally I think it's too cumbersome and probably won't use it. It also doesn't solve issue #2 (if anything, it makes it worse).
I'm still open to suggestions for better solutions! I suspect though it would take an Eclipse plugin to fully achieve what I really want to do.
[project-root]/src/org/foobar/Foo.java:
package org.foobar;
/**
* <link rel="stylesheet" type="text/css" href="../../../javadoc.css"/>
*
* <p class="orange">Foo doc, in orange</p>
*/
public class Foo {
}
[project-root]/javadoc.css
p.orange {
color: orange;
}
Upvotes: 2
Reputation: 2275
I think when you get to the part to export as styled JavaDoc, you can use this Java tool. Also check this book which might help for specifying style sheets for javadoc in Eclipse. And maybe you might also get to the point of creating your own doc generation plugin.
Upvotes: 1