views:

157

answers:

1

Does anyone know of a way to output Javadoc, where line breaks are converted to
tags? I find it quite annoying to have to remember to add
tags on each line of my comments. Without br tags of course the entire comment is condensed into an unreadable block. Ideally the doclet would just replace the line break with a
tag. I google'd quite a bit but didn't come up with anything. I wanted to make sure I'm not missing something before I set out to write my own doclet.

A: 

Better is to insert a <p> tag where you want paragraph breaks. It's pretty ugly to put a line break everywhere you want a line break -- that works badly when someone uses a window much wider or much narrower than what you break at.

NOTE: If you have preformatted text that you want to include in a JavaDoc, then you can use the <pre> tag around this content and your text will not be reformatted into one huge blob. In fact, if you want to explicitly decide where each line break goes, you can use the <pre> tag around your entire JavaDoc, although this is an abuse of the intent of this tag.

Eddie
How is that bad? That is essentially what a wiki does. I just want some basic wiki functionality in my javadoc comments.
Andrew
I doubt that many wikis manually force linebreaks for each linebreak! If you do that and someone changes the width of their browser, then the text will not reflow.
Eddie
I updated my answer to mention the <pre> tag, which may provide what you want.
Eddie