Skip to content

Commit 568c999

Browse files
committed
ehn(api): add unregisterLanguage method
1 parent 6af784f commit 568c999

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

CHANGES.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,17 @@ Language grammar improvements:
1414
- enh(php) Add `mixed` to list of keywords (#2997) [Ayesh][]
1515
- enh(php) Add support binary, octal, hex and scientific numerals with underscore separator support (#2997) [Ayesh][]
1616

17+
API:
18+
19+
- enh(api) add `unregisterLanguage` method (#3009) [Antoine du Hamel][]
20+
1721
[Stef Levesque]: https://github.com/stef-levesque
1822
[Josh Goebel]: https://github.com/joshgoebel
1923
[John Cheung]: https://github.com/Real-John-Cheung
2024
[xDGameStudios]: https://github.com/xDGameStudios
2125
[Ayesh]: https://github.com/Ayesh
2226
[Vyron Vasileiadis]: https://github.com/fedonman
27+
[Antoine du Hamel]: https://github.com/aduh95
2328

2429
## Version 10.6.0
2530

src/highlight.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -814,6 +814,15 @@ const HLJS = function(hljs) {
814814
}
815815
}
816816

817+
/**
818+
* Remove a language grammar module
819+
*
820+
* @param {string} languageName
821+
*/
822+
function unregisterLanguage(languageName) {
823+
delete languages[languageName];
824+
}
825+
817826
/**
818827
* @returns {string[]} List of language internal names
819828
*/
@@ -916,6 +925,7 @@ const HLJS = function(hljs) {
916925
initHighlighting,
917926
initHighlightingOnLoad,
918927
registerLanguage,
928+
unregisterLanguage,
919929
listLanguages,
920930
getLanguage,
921931
registerAliases,

types/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ interface PublicApi {
2424
initHighlightingOnLoad: () => void
2525
highlightAll: () => void
2626
registerLanguage: (languageName: string, language: LanguageFn) => void
27+
unregisterLanguage: (languageName: string) => void
2728
listLanguages: () => string[]
2829
registerAliases: (aliasList: string | string[], { languageName } : {languageName: string}) => void
2930
getLanguage: (languageName: string) => Language | undefined

0 commit comments

Comments
 (0)