/
githubmirror
/
hexo
Обзор
Документация
Войти
/
githubmirror
/
hexo
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
lib/plugins/renderer/yaml.ts
22 строки
643 B
D-Sketon
refactor: refactor types (#5344)
18 янв 2024, 07:59
Не верифицирован
18 янв 2024, 07:59
86350d9
Код
Авторство
О чём код?
import yaml from 'js-yaml'; import { escape } from 'hexo-front-matter'; import logger from 'hexo-log'; import type { StoreFunctionData } from '../../extend/renderer'; let schema: yaml.Schema; // FIXME: workaround for https://github.com/hexojs/hexo/issues/4917 try { schema = yaml.DEFAULT_SCHEMA.extend(require('js-yaml-js-types').all); } catch (e) { if (e instanceof yaml.YAMLException) { logger().warn('YAMLException: please see https://github.com/hexojs/hexo/issues/4917'); } else { throw e; } } function yamlHelper(data: StoreFunctionData): any { return yaml.load(escape(data.text), { schema }); } export = yamlHelper;