本文整理匯總了TypeScript中prismjs.highlight函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript highlight函數的具體用法?TypeScript highlight怎麽用?TypeScript highlight使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了highlight函數的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: render
render() {
jQuery("pre", this.element).remove();
let pre = document.createElement("pre");
this.element.appendChild(pre);
this.html = prism.plugins.NormalizeWhitespace.normalize(this.html);
pre.innerHTML = prism.highlight(this.html, prism.languages[this.language]);
}
示例2: renderPreview
private renderPreview(context) {
if (context) {
if (context.html) {
return Prism.highlight(context.html, Prism.languages.html, true);
}
return `[No Html available for ${context.title}]`;
}
return "";
}
示例3:
highlight: (code) => Prism.highlight(code.trim(), Prism.languages.jsx)
示例4: highlight
highlight(code: string, lang: string) {
return prism.highlight(code.trim(), prism.languages[lang]);
}
示例5: highlight
export function highlight(code: string, language: string): string {
const prismLanguage = LanguageMap[language];
return Prism.highlight(code, prismLanguage);
}