mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-26 02:23:43 +03:00
fix: pass boolean and number values as a string in highlight function (#1512)
This commit is contained in:
parent
0dce880dce
commit
c874a5942c
|
@ -68,11 +68,11 @@ export function mapLang(lang: string): string {
|
|||
* @param lang highlight language
|
||||
* @return highlighted source code as **html string**
|
||||
*/
|
||||
export function highlight(source: string, lang: string = DEFAULT_LANG): string {
|
||||
export function highlight(source: string | number | boolean, lang: string = DEFAULT_LANG): string {
|
||||
lang = lang.toLowerCase();
|
||||
let grammar = Prism.languages[lang];
|
||||
if (!grammar) {
|
||||
grammar = Prism.languages[mapLang(lang)];
|
||||
}
|
||||
return Prism.highlight(source, grammar, lang);
|
||||
return Prism.highlight(source.toString(), grammar, lang);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user