File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,11 @@ import * as builtIns from "builtInLanguages";
55const hljs = HighlightJS ;
66
77for ( const key of Object . keys ( builtIns ) ) {
8- const languageName = key . replace ( "grmr_" , "" ) ;
8+ // our builtInLanguages Rollup plugin has to use `_` to allow identifiers to be
9+ // compatible with `export` naming conventions, so we need to convert the
10+ // identifiers back into the more typical dash style that we use for language
11+ // naming via the API
12+ const languageName = key . replace ( "grmr_" , "" ) . replace ( "_" , "-" ) ;
913 hljs . registerLanguage ( languageName , builtIns [ key ] ) ;
1014}
1115// console.log(hljs.listLanguages());
Original file line number Diff line number Diff line change @@ -21,4 +21,13 @@ API.forEach(n => {
2121 assert ( _ => keys . includes ( n ) , `API should include ${ n } ` ) ;
2222} ) ;
2323
24+ // See e.g. highlightjs/highlight.js#3263
25+ const langs = [ "python" , "python-repl" ]
26+ langs . forEach ( n => {
27+ assert ( _ => {
28+ res = hljs . getLanguage ( n ) ;
29+ return typeof res === 'object' && res !== null
30+ } )
31+ } )
32+
2433console . log ( "Pass: browser build works with Node.js just fine." )
You can’t perform that action at this time.
0 commit comments