Skip to content

Commit

Permalink
ehn(api): add unregisterLanguage method
Browse files Browse the repository at this point in the history
  • Loading branch information
aduh95 committed Feb 15, 2021
1 parent 6af784f commit 568c999
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,17 @@ Language grammar improvements:
- enh(php) Add `mixed` to list of keywords (#2997) [Ayesh][]
- enh(php) Add support binary, octal, hex and scientific numerals with underscore separator support (#2997) [Ayesh][]

API:

- enh(api) add `unregisterLanguage` method (#3009) [Antoine du Hamel][]

[Stef Levesque]: https://github.com/stef-levesque
[Josh Goebel]: https://github.com/joshgoebel
[John Cheung]: https://github.com/Real-John-Cheung
[xDGameStudios]: https://github.com/xDGameStudios
[Ayesh]: https://github.com/Ayesh
[Vyron Vasileiadis]: https://github.com/fedonman
[Antoine du Hamel]: https://github.com/aduh95

## Version 10.6.0

Expand Down
10 changes: 10 additions & 0 deletions src/highlight.js
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,15 @@ const HLJS = function(hljs) {
}
}

/**
* Remove a language grammar module
*
* @param {string} languageName
*/
function unregisterLanguage(languageName) {
delete languages[languageName];
}

/**
* @returns {string[]} List of language internal names
*/
Expand Down Expand Up @@ -916,6 +925,7 @@ const HLJS = function(hljs) {
initHighlighting,
initHighlightingOnLoad,
registerLanguage,
unregisterLanguage,
listLanguages,
getLanguage,
registerAliases,
Expand Down
1 change: 1 addition & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ interface PublicApi {
initHighlightingOnLoad: () => void
highlightAll: () => void
registerLanguage: (languageName: string, language: LanguageFn) => void
unregisterLanguage: (languageName: string) => void
listLanguages: () => string[]
registerAliases: (aliasList: string | string[], { languageName } : {languageName: string}) => void
getLanguage: (languageName: string) => Language | undefined
Expand Down

0 comments on commit 568c999

Please sign in to comment.