Skip to content

Commit

Permalink
chore: clean up code
Browse files Browse the repository at this point in the history
  • Loading branch information
UziTech committed Dec 15, 2023
1 parent 42204fb commit 0bd915f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function markedHighlight(options) {
return;
}

const lang = getLang(token);
const lang = getLang(token.lang);

if (options.async) {
return Promise.resolve(options.highlight(token.text, lang, token.lang || '')).then(updateToken(token));
Expand All @@ -34,7 +34,7 @@ export function markedHighlight(options) {
},
renderer: {
code(code, infoString, escaped) {
const lang = (infoString || '').match(/\S*/)[0];
const lang = getLang(infoString);
const classAttr = lang
? ` class="${options.langPrefix}${escape(lang)}"`
: '';
Expand All @@ -45,8 +45,8 @@ export function markedHighlight(options) {
};
}

function getLang(token) {
return (token.lang || '').match(/\S*/)[0];
function getLang(lang) {
return (lang || '').match(/\S*/)[0];
}

function updateToken(token) {
Expand Down

0 comments on commit 0bd915f

Please sign in to comment.