File tree 2 files changed +25
-1
lines changed
scaladoc/resources/dotty_res
2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -89,7 +89,30 @@ window.addEventListener("DOMContentLoaded", () => {
89
89
90
90
hljs . registerLanguage ( "scala" , highlightDotty ) ;
91
91
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
+
93
116
94
117
/* listen for the `F` key to be pressed, to focus on the member filter input (if it's present) */
95
118
document . body . addEventListener ( 'keydown' , e => {
Original file line number Diff line number Diff line change 88
88
margin : 0px ;
89
89
}
90
90
pre code , pre code .hljs {
91
+ font-family : var (--mono-font );
91
92
font-size : 1em ;
92
93
padding : 0 ;
93
94
}
You can’t perform that action at this time.
0 commit comments