/
githubmirror
/
components
Обзор
Документация
Войти
/
githubmirror
/
components
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
tools/highlight-files/highlight-code-block.mts
15 строк
462 B
Kristiyan Kostadinov
build: update to marked v16 and resolve breakages
01 июл 2025, 12:09
01 июл 2025, 12:09
ceb6e34
Код
Авторство
О чём код?
import highlightJs from 'highlight.js'; /** * Transforms a given code block into its corresponding HTML output. We do this using * highlight.js because it allows us to show colored code blocks in our documentation. */ export function highlightCodeBlock(code: string, language?: string) { if (language) { return highlightJs.highlight(code, { language: language.toLowerCase() === 'ts' ? 'typescript' : language, }).value; } return code; }