1

I tried to add styling to a <pre> block using: https://github.com/google/code-prettify

But all I see is this:

enter image description here

I am looking to get the default syntax highlighting.

I put this at the top of the html file:

and then I have a <pre> block that looks like so:

  /**
   * <pre class="prettyprint">
   * new BeanTranslator.Builder()
   *   .translate(
   *     new{@code Translator<String, Integer>}(String.class, Integer.class){
   *      {@literal @}Override
   *       public Integer translate(String instance) {
   *         return Integer.valueOf(instance);
   *       }})
   *   .build();
   * </pre>
   */

I inspected the html and it looks like so:

enter image description here

What I doing wrong?

  • Have you put the link to the library in the header of the document? – Oscar W Feb 18 '19 at 00:34
  • yep I sure did, but I will double check –  Feb 18 '19 at 00:37
  • 1
    It appears java might be converting `@code` to the literal html `` tag somehow. There are 2 code tags in your `
    ` tag.
    – soulshined Feb 18 '19 at 00:39
  • 1
    Can you also post the full `
    ` tag that you're using. I can't see the `public static ` ect
    – Oscar W Feb 18 '19 at 00:39
  • With Javadoc there are many many entrypoints, so I need to figure out a way to include a script tag in more than 1 index.html file. –  Feb 18 '19 at 00:42
  • have you tried escaping the @code tag or `&commat;` for the `@` symbol – soulshined Feb 18 '19 at 00:44
  • 1
    I got it to work...thanks.. with javadoc, there are many entrypoints to the page, so I have to include the script tag in all the html files unless someone knows a good trick –  Feb 18 '19 at 00:50

0 Answers0