pengzhanbo 149732520a
feat: add multiple provider support for icon, close #568 (#596)
* feat: add multiple provider support for icon

* chore: tweak

* chore: tweak
2025-05-16 11:03:41 +08:00

20 lines
704 B
TypeScript

import type { MarkdownPowerPluginOptions } from '../shared/index.js'
import { isPackageExists } from 'local-pkg'
export function provideData(options: MarkdownPowerPluginOptions): Record<string, unknown> {
const mardownOptions = {
plot: options.plot,
pdf: options.pdf,
}
const icon = options.icon ?? { provider: 'iconify' }
return {
__MD_POWER_INJECT_OPTIONS__: mardownOptions,
__MD_POWER_DASHJS_INSTALLED__: isPackageExists('dashjs'),
__MD_POWER_HLSJS_INSTALLED__: isPackageExists('hls.js'),
__MD_POWER_MPEGTSJS_INSTALLED__: isPackageExists('mpegts.js'),
__MD_POWER_ICON_PROVIDER__: icon.provider || 'iconify',
__MD_POWER_ICON_PREFIX__: icon.prefix || '',
}
}