File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change 110110 if ( config . type === 'window' ) {
111111 cfg . defaults = { }
112112 }
113-
113+ if ( ! config . lang ) {
114+ if ( cfg . type . includes ( "python" ) ) {
115+ config . lang = "python"
116+ }
117+ else if ( cfg . type . includes ( "javascript" ) ) {
118+ config . lang = "javascript"
119+ }
120+ else {
121+ console . error ( '"lang" is not specified, please make sure decorate the code block with the name of the language.' )
122+ }
123+ }
114124 if ( config . lang !== 'html' )
115125 src = `<config lang="json">\n${ JSON . stringify ( cfg , null , 1 ) } \n</config>\n<script lang="${ config . lang } ">\n${ src } <\/script>` ;
116126 else
312322 preElm . pluginConfig . id = id ;
313323
314324 preElm . pluginConfig . namespace = id ;
325+ // for some reason, the data-lang attribute disappeared in the newer version
315326 preElm . pluginConfig . lang = preElm . getAttribute ( 'data-lang' ) ;
316327
317328 const outputFullscreenElm = preElm . querySelector ( ".fullscreen-button" ) ;
694705 initializeRunButtons ( ) ;
695706 } ) ;
696707
697- } ) ( ) ;
708+ } ) ( ) ;
You can’t perform that action at this time.
0 commit comments