Skip to content

Commit

Permalink
(chore) remove requireLanguage
Browse files Browse the repository at this point in the history
  • Loading branch information
joshgoebel committed Mar 21, 2021
1 parent 24f9c70 commit 25d5e59
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 22 deletions.
21 changes: 0 additions & 21 deletions src/highlight.js
Original file line number Diff line number Diff line change
Expand Up @@ -794,26 +794,6 @@ const HLJS = function(hljs) {
return Object.keys(languages);
}

/**
intended usage: When one language truly requires another
Unlike `getLanguage`, this will throw when the requested language
is not available.
@param {string} name - name of the language to fetch/require
@returns {Language | never}
*/
function requireLanguage(name) {
logger.deprecated("10.4.0", "requireLanguage will be removed entirely in v11.");
logger.deprecated("10.4.0", "Please see https://github.com/highlightjs/highlight.js/pull/2844");

const lang = getLanguage(name);
if (lang) { return lang; }

const err = new Error('The \'{}\' language is required, but not loaded.'.replace('{}', name));
throw err;
}

/**
* @param {string} name - name of the language to retrieve
* @returns {Language | undefined}
Expand Down Expand Up @@ -916,7 +896,6 @@ const HLJS = function(hljs) {
listLanguages,
getLanguage,
registerAliases,
requireLanguage,
autoDetection,
inherit,
addPlugin,
Expand Down
1 change: 0 additions & 1 deletion types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ interface PublicApi {
listLanguages: () => string[]
registerAliases: (aliasList: string | string[], { languageName } : {languageName: string}) => void
getLanguage: (languageName: string) => Language | undefined
requireLanguage: (languageName: string) => Language | never
autoDetection: (languageName: string) => boolean
inherit: <T>(original: T, ...args: Record<string, any>[]) => T
addPlugin: (plugin: HLJSPlugin) => void
Expand Down

0 comments on commit 25d5e59

Please sign in to comment.