/
githubmirror
/
material-ui
Обзор
Документация
Войти
/
githubmirror
/
material-ui
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
packages-internal/api-docs-builder/src/utils/escapeCell.ts
15 строк
557 B
Brijesh Bittu
[docs-infra] Rename package to @mui/internal-api-docs-builder (#48230)
21 апр 2026, 12:17
Не верифицирован
21 апр 2026, 12:17
c11f4ee
Код
Авторство
О чём код?
function escapePipesOutsideBackticks(value: string): string { // Split into chunks that are either code spans or normal text. // Capturing group keeps the code chunks in the array. return value .split(/(`[^`]*`)/g) .map((chunk) => (chunk.startsWith('`') ? chunk : chunk.replace(/\|/g, '\\|'))) .join(''); } export default function escapeCell(value: string): string { // As the pipe is use for the table structure const newValue = escapePipesOutsideBackticks(value); return newValue.replace(/</g, '<').replace(/`</g, '`<'); }