File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -106,6 +106,10 @@ hljs.initLineNumbersOnLoad({
106106hljs .lineNumbersBlock (myCodeBlock, myOptions);
107107```
108108
109+ ``` js
110+ hljs .lineNumbersBlockSync (myCodeBlock, myOptions);
111+ ```
112+
109113``` js
110114hljs .lineNumbersValue (myCodeBlock, myOptions);
111115```
Original file line number Diff line number Diff line change 1414 if ( w . hljs ) {
1515 w . hljs . initLineNumbersOnLoad = initLineNumbersOnLoad ;
1616 w . hljs . lineNumbersBlock = lineNumbersBlock ;
17+ w . hljs . lineNumbersBlockSync = lineNumbersBlockSync ;
1718 w . hljs . lineNumbersValue = lineNumbersValue ;
18- w . hljs . lineNumbersInternal = lineNumbersInternal ;
1919
2020 addStyles ( ) ;
2121 } else {
182182 } ) ;
183183 }
184184
185+ function lineNumbersBlockSync ( element , options ) {
186+ if ( typeof element !== 'object' ) return ;
187+
188+ element . innerHTML = lineNumbersInternal ( element , options ) ;
189+ }
190+
185191 function lineNumbersValue ( value , options ) {
186192 if ( typeof value !== 'string' ) return ;
187193
You can’t perform that action at this time.
0 commit comments