File tree Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -16,4 +16,8 @@ describe('prism.js helpers', () => {
16
16
test ( 'highlight raw text should just return text' , ( ) => {
17
17
expect ( highlight ( 'Hello world' , 'clike' ) ) . toBe ( 'Hello world' ) ;
18
18
} ) ;
19
+
20
+ test ( 'highlight should not throw with lang undefined' , ( ) => {
21
+ expect ( highlight ( 'Hello world' , undefined ) ) . toBe ( 'Hello world' ) ;
22
+ } ) ;
19
23
} ) ;
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ export function mapLang(lang: string): string {
42
42
* @param lang highlight language
43
43
* @return highlighted souce code as **html string**
44
44
*/
45
- export function highlight ( source : string , lang : string ) : string {
45
+ export function highlight ( source : string , lang : string = DEFAULT_LANG ) : string {
46
46
lang = lang . toLowerCase ( ) ;
47
47
let grammar = Prism . languages [ lang ] ;
48
48
if ( ! grammar ) {
You can’t perform that action at this time.
0 commit comments