From 5d1a83166fbe335a41709d164478ca99daaa41db Mon Sep 17 00:00:00 2001 From: uiolee <22849383+uiolee@users.noreply.github.com> Date: Fri, 2 Feb 2024 15:03:57 +0800 Subject: [PATCH] feat(scripts): use hljs internal method to get aliases --- scripts/build_highlight_alias.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/build_highlight_alias.js b/scripts/build_highlight_alias.js index ad2fe56b..28516cb5 100644 --- a/scripts/build_highlight_alias.js +++ b/scripts/build_highlight_alias.js @@ -1,7 +1,7 @@ const hljs = require('highlight.js'); -const languages = hljs.listLanguages(); const fs = require('fs'); +const languages = hljs.listLanguages(); const result = { languages: languages, aliases: {} @@ -10,8 +10,7 @@ const result = { languages.forEach(lang => { result.aliases[lang] = lang; - const def = require('highlight.js/lib/languages/' + lang)(hljs); - const aliases = def.aliases; + const aliases = hljs.getLanguage(lang).aliases; if (aliases) { aliases.forEach(alias => {