${esc(p.name)}
${esc(p.desc)}
#!/usr/bin/env node
'use strict'
// 生成插件市场展示页:market/index.json → market.html(纯静态,无后端)
// 设计目标:与下载页同一套视觉;卡片墙 + 搜索 + 标签筛选;「安装」只在应用内做,这里只展示。
const fs = require('fs')
const path = require('path')
const root = path.resolve(__dirname, '..')
const index = JSON.parse(fs.readFileSync(path.join(root, 'market', 'index.json'), 'utf8'))
const list = Array.isArray(index.plugins) ? index.plugins : []
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]))
const tags = []
for (const p of list) for (const t of (p.tags || [])) if (tags.indexOf(t) < 0) tags.push(t)
const kb = (n) => n >= 1024 * 1024 ? (n / 1048576).toFixed(1) + ' MB' : Math.max(1, Math.round(n / 1024)) + ' KB'
const card = (p) => `
${esc(p.desc)}${esc(p.name)}
Image Workbench 插件 · 共 ${list.length} 个 · 在应用内「设置 → 插件」安装