@@ -234,7 +234,7 @@ export async function renderMarkdownDocument(
234
234
namespace MarkedHighlight {
235
235
// Copied from https://github.com/markedjs/marked-highlight/blob/main/src/index.js
236
236
237
- export function markedHighlight ( options : marked . MarkedOptions & { highlight : ( code : string , lang : string , info : string ) => string | Promise < string > } ) : marked . MarkedExtension {
237
+ export function markedHighlight ( options : marked . MarkedOptions & { highlight : ( code : string , lang : string ) => string | Promise < string > } ) : marked . MarkedExtension {
238
238
if ( typeof options === 'function' ) {
239
239
options = {
240
240
highlight : options ,
@@ -252,13 +252,11 @@ namespace MarkedHighlight {
252
252
return ;
253
253
}
254
254
255
- const lang = getLang ( token . lang ) ;
256
-
257
255
if ( options . async ) {
258
- return Promise . resolve ( options . highlight ( token . text , lang , token . lang || '' ) ) . then ( updateToken ( token ) ) ;
256
+ return Promise . resolve ( options . highlight ( token . text , token . lang ) ) . then ( updateToken ( token ) ) ;
259
257
}
260
258
261
- const code = options . highlight ( token . text , lang , token . lang || '' ) ;
259
+ const code = options . highlight ( token . text , token . lang ) ;
262
260
if ( code instanceof Promise ) {
263
261
throw new Error ( 'markedHighlight is not set to async but the highlight function is async. Set the async option to true on markedHighlight to await the async highlight function.' ) ;
264
262
}
@@ -276,10 +274,6 @@ namespace MarkedHighlight {
276
274
} ;
277
275
}
278
276
279
- function getLang ( lang : string ) {
280
- return ( lang || '' ) . match ( / \S * / ) ! [ 0 ] ;
281
- }
282
-
283
277
function updateToken ( token : any ) {
284
278
return ( code : string ) => {
285
279
if ( typeof code === 'string' && code !== token . text ) {
0 commit comments