3

I generated some javadocs, looks pretty good, I can even include inline code samples/examples. However, doesn't look very good on mobile:

enter image description here

Here are the plugin settings I am using:

     <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>3.0.1</version>
            <executions>
                <execution>
                    <id>attach-javadocs</id>
                    <goals>
                        <goal>jar</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <additionalOptions>-html5</additionalOptions>
                <additionalJOptions>--allow-script-in-comments</additionalJOptions>
            </configuration>
        </plugin>

maybe there is a command line flag I can use to generate mobile-friendly documentation? If not, how do I add a +1 to the plugin authors to encourage them to make the docs responsive somehow?

JJJ
  • 32,902
  • 20
  • 89
  • 102

2 Answers2

2

Have you considered creating a stylesheet?

https://docs.oracle.com/javase/8/docs/technotes/tools/windows/javadoc.html#BEJFCAIH

javadoc ... -stylesheetfile  path\filename

Here are some links on using "responsive CSS" for mobile:

paulsm4
  • 114,292
  • 17
  • 138
  • 190
  • 1
    it might work but I am no good at css, I would hope that by 2019 Javadoc people would have had this under control but idk? –  Feb 18 '19 at 03:08
  • 1
    I guess typically when programmers are programming (and reading javadoc) they don't do that on their mobile phones, but behind a reasonably-sized screen instead, – Erwin Bolwidt Feb 18 '19 at 04:51
  • 1
    You don't have to be "good at CSS". Just "play around", using [@Media{}](https://developer.mozilla.org/en-US/docs/Web/CSS/@media), and see what you come up with. Here's a good place to start: https://www.w3schools.com/css/css_rwd_mediaqueries.asp – paulsm4 Feb 18 '19 at 05:24
  • Thanks paulsm4, if it's a matter of just increasing font size, it might work, but I am pessimistic. @Erwin Bolwidt, I agree 90% developers will be reading from desktop, but I sometimes read docs on my phone when I am just trying to get ideas. –  Feb 18 '19 at 07:02
0

This is old but I don't like the other answer because for me there where problems with the viewport making it hard to use @media CSS to solve it.

I ended up inserting a variable viewport into the doc using the header. This is not the nicest solution since the header is not the head element but something inside the body, but in modern browsers it still works. Here is my code:

<!-- Javadoc -->
    <plugin>
        <configuration>
            <header><![CDATA[<meta name='viewport' content='width=device-width, initial-scale=1.0'>]]></header>
            ...
        </configuration>
        ...
    </plugin>
Tim Rasim
  • 655
  • 7
  • 20