How to change default javadoc stylesheet? - stylesheet

Is there a command line option to change the stylesheet file created by javadoc?
I would like to use my own css file.
The default blue one is boring. I tried a -stylesheet option, but it's not supported.

Yes, it's possible and actually quite straightforward. If you look for example at Mockito's javadoc:
http://docs.mockito.googlecode.com/hg/org/mockito/Mockito.html (you can see that they have changed the default appereance just using this stylesheet)
If you are using Maven, you can do that by adding some config in the maven-javadoc-plugin:
http://maven.apache.org/plugins/maven-javadoc-plugin/examples/stylesheet-configuration.html.
In case you are using ant, there is a way to inject the parameter to the javadoc tool:
http://ant.apache.org/manual/Tasks/javadoc.html
For more information, there are some discussion topics about that in stackoverflow: JavaDoc Style Sheets

For the maven-javadoc-plugin, you can also use:
<configuration>
<addStylesheets>our-stylesheet.css</addStylesheets>
</configuration>
which keeps the primary stylesheet, but then also adds the custom one, so that all you need to do is override the rules you want.
Put our-stylesheet.css in the src/main/javadoc directory.

Related

How do I make my modified Intellij 'intention' available to my colleagues?

I have modified an Intellij 'intention'. (I changed the initialization of the JUnit test class).
How do I make this available to other members of my organization? We are all working on the same Intellij 'project', but I believe that these changes are on a per-user, not per-project basis. (If there is a way to make the changes apply only to one project, I would prefer that).
File | Export Setting / File | Import Settings.
Are more robust way would be to use the Settings Repository plug-in.
Templates are stored in the %CONFIG% directory, fileTemplates subdirectory.
To export the file, you set the 'Schema:' pulldown in the upper right corner of 'Settings->Editor->File and Code Templates->Code tab' to 'Project' This will cause IDEA to create a folder PROJECT/.idea/fileTemplates/code, and put your modified file there. Details are in:
https://www.jetbrains.com/help/idea/2016.3/file-and-code-templates.html#d2040410e142

Exporting code style settings from IntelliJ IDEA version 14.1.5

I'm using the updated version of the IntelliJ IDEA and am trying to export my code style settings so that they can be used by all developers working on a particular project. I read the tutorials at https://confluence.jetbrains.com/display/IntelliJIDEA/Code+Styles and http://forum.shakacode.com/t/sharing-your-intellij-rubymine-webstorm-codestyle-among-developers/240, which seems fairly simple.
Unfortunately that is not how my 'export settings' pane looks like, and I don't have a line that says 'code styles'. Mine looks like
The closest I can find is the line I highlighted which has CodeStyleSettingsManager in it along with a whole bunch of other stuff. However I tried using that and extracted the .jar file only to find that there was nothing much inside at all.
Does anyone know a way of exporting code styles that works with the latest version of IntelliJ?
Edit: My codeStyleSettings.xml file only contains the following:
<project version="4">
<component name="ProjectCodeStyleSettingsManager">
<option name="PER_PROJECT_SETTINGS">
<value/>
</option>
<option name="USE_PER_PROJECT_SETTINGS" value="true"/>
</component>
</project>
I don't understand, why you don't see Code Style in your list (it appears in my IDEA 14.1.5), but...
(...) export my code style settings so that they can be used by all developers working on a particular project
A better way to share the project code style across all developers is to include it in your VCS repository. Pulling such a commit will apply those code styles automatically. This is the file: project/.idea/codeStyleSettings.xml. If your VCS is set to ignore .idea/, add an exception for this file.
If you don't see this file at all, you're probably using a local formatter and your Project scheme is unchanged. In this case, go to Settings > Editor > Code Style > Scheme: Manage, select your formatter and click Copy to Project.
Update
Code style files only state the difference to the IDEA Default Code style (which is always the same). You can try this yourself: create a new project, go the the Code Style settings, select Project and change only one option. The codeStyleSettings.xml file will be created, and it will contain only this one option. If you could export your code style settings, the output would be exactly the same.

Removing Doxygen code fragments/references

I'm using Doxygen for generating documentation in my programming projects. And while I find it quite easy to configure and use I can't seem to find a way to hide the source references it adds to the HTML output.
I'm using these two directives in the configuration file:
SOURCE_BROWSER = NO
VERBATIM_HEADERS = NO
But it only seems to hide the "Definition at line of file ."
What I want removed is what's in the red rectangle below:
Is there a directive to also hide the source code it references? (Other than doing the hack'ish thing and remove it with CSS or jQuery)
Make sure your setting on INLINE_SOURCES is set to NO.
Description from the manual - it looks like you have this YES
Setting the INLINE_SOURCES tag to YES will include the body of functions, classes and enums directly into the documentation.

How to disable code formatting for some part of the code using comments?

I'd like to selectively disable the IntelliJ IDEA code formatter for a portion of code just like I can in Eclipse. Does IntelliJ support this feature, and if so, how do I use it?
Since version 13 it's possible to wrap the code with
// #formatter:off
...
// #formatter:on
IntelliJ IDEA v.2018+:
File > Settings > Editor > Code Style
IntelliJ IDEA v.2016+:
Preferences > Editor > Code Style
IntelliJ IDEA v.14+:
Preferences > Editor > Code Style > Formatter Control
You can change the formatter control markers, as long as they're in comments.
Ensure formatter markers in comments are enabled, as shown in the following figure:
Note for Carlos' answer of #formatter:off and #formatter:on to work, you may need to enable the preference first:
Discovered via How to config intellij-idea not format some part of the code?
IDEA-56995 Disabled code formatting per region using comments
In xml files, use:
<!-- #formatter:off -->
<!-- #formatter:on -->
Obsolete answer from 2010:
No, it's not possible right now, I've submitted a new issue which you can track.
As a temporary solution you can use external formatter plug-in for IDEA which can utilize Eclipse code formatter (I didn't check whether this particular option is supported).
It's currently not possible to exclude entire files (like regression test data xmls) from formatting. See https://youtrack.jetbrains.com/issue/IDEA-167112

Why does the default IntelliJ default class javadoc comment use non-standard syntax?

Why does the default IntelliJ default class javadoc comment use non-standard syntax? Instead of creating a line with "User: jstauffer" it could create a line with "#author jstauffer". The other lines that it creates (Date and Time) probably don't have javadoc syntax to use but why not use the javadoc syntax when available?
For reference here is an example:
/**
* Created by IntelliJ IDEA.
* User: jstauffer
* Date: Nov 13, 2007
* Time: 11:15:10 AM
* To change this template use File | Settings | File Templates.
*/
I'm not sure why Idea doesn't use the #author tag by default.
But you can change this behavior by going to File -> Settings -> File Templates and editing the File Header entry in the Includes tab.
As of IDEA 14 it's: File -> Settings -> Editor -> File and Code Templates -> Includes -> File Header
In AndroidStuido 1.0.2 on Mac
Go in Preferences
then on left span File and Code Templates
After selecting file and code templates on right hand side select includes tab select
file Header and change your file header.
The default is readable, usable, but does not adhere to or suggest any coding standard.
I think the reason IntelliJ doesn't use the Javadoc tags in the default, is so that it avoids possible interference with any coding/javadoc standards that might exist in development shops. It should be obvious to the user if the default needs to be modified to something more appropriate.
Where I am working, the use of author tags is discouraged, for various reasons.
Because it's a default file template that you're supposed to change to your organization's standard, or your tastes.
My best guess.
It is likely that the header snippet you show is older than javadoc and was just borrowed from some coding standard document, probably written for C++.