File tree Expand file tree Collapse file tree 3 files changed +28
-4
lines changed
scaladoc/resources/dotty_res Expand file tree Collapse file tree 3 files changed +28
-4
lines changed Original file line number Diff line number Diff line change @@ -140,14 +140,14 @@ input:checked + .slider:before {
140140 transition : all .2s ease;
141141 opacity : 0 ;
142142 visibility : hidden;
143+ display : flex;
144+ flex-direction : row-reverse;
145+ justify-content : flex-start;
143146}
144147
145148.snippet : hover .buttons {
146149 opacity : 1 ;
147150 visibility : visible;
148- display : flex;
149- flex-direction : row-reverse;
150- justify-content : flex-start;
151151}
152152
153153.snippet .buttons button {
Original file line number Diff line number Diff line change @@ -89,7 +89,30 @@ window.addEventListener("DOMContentLoaded", () => {
8989
9090 hljs . registerLanguage ( "scala" , highlightDotty ) ;
9191 hljs . registerAliases ( [ "dotty" , "scala3" ] , "scala" ) ;
92- hljs . initHighlighting ( ) ;
92+
93+ var aliases = [ 'language-scala' , 'language-dotty' , 'language-scala3' ]
94+
95+ var highlightDeep = function ( el ) {
96+ el . childNodes . forEach ( node => {
97+ if ( node . nodeType == Node . TEXT_NODE ) {
98+ let newNode = document . createElement ( 'span' ) ;
99+ newNode . innerHTML = hljs . highlight ( node . textContent , { language : 'scala' } ) . value ;
100+ el . insertBefore ( newNode , node ) ;
101+ el . removeChild ( node ) ;
102+ } else if ( node . nodeType == Node . ELEMENT_NODE ) {
103+ highlightDeep ( node ) ;
104+ }
105+ } )
106+ }
107+
108+ document . querySelectorAll ( 'pre code' ) . forEach ( el => {
109+ if ( aliases . some ( alias => el . classList . contains ( alias ) ) ) {
110+ highlightDeep ( el ) ;
111+ } else {
112+ hljs . highlightElement ( el ) ;
113+ }
114+ } ) ;
115+
93116
94117 /* listen for the `F` key to be pressed, to focus on the member filter input (if it's present) */
95118 document . body . addEventListener ( 'keydown' , e => {
Original file line number Diff line number Diff line change 8888 margin : 0px ;
8989}
9090pre code , pre code .hljs {
91+ font-family : var (--mono-font );
9192 font-size : 1em ;
9293 padding : 0 ;
9394}
You can’t perform that action at this time.
0 commit comments