Skip to content

Commit

Permalink
Merge pull request #45 from techsin/main
Browse files Browse the repository at this point in the history
Update index.js
  • Loading branch information
matubu authored Jun 2, 2024
2 parents 249ad8f + d9ef6a4 commit e93a2ec
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 @@ -159,9 +159,9 @@ export async function highlightElement(elm, lang = elm.className.match(/shj-lang
* @param {ShjOptions} [opt={}] Customization options
*/
export let highlightAll = async (opt) =>
document
.querySelectorAll('[class*="shj-lang-"]')
.forEach(elm => highlightElement(elm, undefined, undefined, opt))
await Promise.all(
Array.from(document.querySelectorAll('[class*="shj-lang-"]'))
.map(elem => highlightElement(elm, undefined, undefined, opt)))

/**
* @typedef {{ match: RegExp, type: string }
Expand All @@ -183,4 +183,4 @@ export let highlightAll = async (opt) =>
*/
export let loadLanguage = (languageName, language) => {
langs[languageName] = language;
}
}

0 comments on commit e93a2ec

Please sign in to comment.