RFR: 8266666: Implementation for snippets [v3]

Hannes Wallnöfer hannesw at openjdk.java.net
Tue Jul 27 18:36:34 UTC 2021


On Tue, 27 Jul 2021 15:59:00 GMT, Pavel Rappo <prappo at openjdk.org> wrote:

>> src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/snippet/parser/Parser.java line 275:
>> 
>>> 273:                         throw new ParseException("Unexpected attributes", t.lineSourceOffset + t.markupLineOffset + t.nameLineOffset);
>>> 274:                     }
>>> 275:                     actions.add(new Bookmark(region.value(), text.subText(t.start(), t.end() - 1)));
>> 
>> This method is a bit hard on the eyes and runs quite wide. Maybe add a few more line breaks on those very long lines?
>
> So just to be clear, Hannes. Do you suggest to structure the rules like this?
> 
> 
> pre.snippet {
>     background-color: #e8e8e8;
>     padding: 10px;
>     margin: 12px 0;
>     overflow: auto;
>     white-space: pre;
> }
> 
> pre.snippet .italic {
>     font-style: italic;
> }
> 
> pre.snippet .bold {
>     font-weight: bold;
> }
> 
> pre.snippet .highlighted {
>     background-color: sandybrown;
>     border-radius: 10%;
> }

Yes, that's what I would propose. It limits the definitions to contents of `<pre class="snippet">` elements. Another idea would have been to use snippet-specific class names such as `.snippet-italic`, but that's more verbose and less elegant.

-------------

PR: https://git.openjdk.java.net/jdk/pull/4795


More information about the javadoc-dev mailing list