/
githubmirror
/
vuetify
Обзор
Документация
Войти
/
githubmirror
/
vuetify
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
packages/docs/src/components/api/utils.ts
23 строки
621 B
Kael
docs(api): fix link formatting with generic types
15 сен 2025, 11:45
15 сен 2025, 11:45
edb8532
Код
Авторство
О чём код?
export function stripLinks (str: string): [string, Record<string, string>] { let out = str.slice() const obj: Record<string, string> = {} const regexp = /<a .+?>(.+?)<\/a>/g let matches = regexp.exec(str) while (matches !== null) { obj[matches[1]] = matches[0] out = out.replace(matches[0], matches[1]) matches = regexp.exec(str) } return [out, obj] } export function insertLinks (str: string, stripped: Record<string, string>) { for (const [key, value] of Object.entries(stripped)) { str = str.replaceAll(new RegExp(`(^|\\W)(${key})(\\W|$)`, 'g'), `$1${value}$3`) } return str }