chore: tweak

This commit is contained in:
pengzhanbo 2024-09-23 12:26:17 +08:00
parent b85a9e7a01
commit 1e779a7b86
2 changed files with 11 additions and 33 deletions

View File

@ -18,15 +18,13 @@ export const codeTabs: PluginSimple = (md) => {
const titlesContent = titles.map((title, index) => {
const icon = getFileIconName(title)
return `\<template #title${index}="{ value, isActive }">${icon ? `<VPIcon name="${icon}"/>` : ''}<span>${title}</span></template>`
return `<template #title${index}="{ value, isActive }">${icon ? `<VPIcon name="${icon}"/>` : ''}<span>${title}</span></template>`
}).join('')
return `<CodeTabs id="${index}" :data='${stringifyProp(tabsData)}'${active === -1 ? '' : ` :active="${active}"`}${meta.id ? ` tab-id="${meta.id as string}"` : ''}>${titlesContent}`
},
tabsCloseRenderer: () => `\
</CodeTabs>
`,
tabsCloseRenderer: () => `</CodeTabs>`,
tabOpenRenderer: ({ index }, tokens, tokenIndex) => {
let foundFence = false
@ -49,13 +47,9 @@ export const codeTabs: PluginSimple = (md) => {
}
}
return `\
<template #tab${index}="{ value, isActive }">
`
return `<template #tab${index}="{ value, isActive }">`
},
tabCloseRenderer: () => `\
</template>
`,
tabCloseRenderer: () => `</template>`,
})
}

View File

@ -15,33 +15,17 @@ export const tabs: PluginSimple = (md) => {
return { id }
})
return `\
<Tabs id="${index}" :data='${stringifyProp(tabsData)}'${
active === -1 ? '' : ` :active="${active}"`
}${
meta.id ? ` tab-id="${meta.id as string}"` : ''
}>
${titles
.map(
(title, titleIndex) => `\
<template #title${titleIndex}="{ value, isActive }">${title}</template>
`,
)
.join('')}\
`
return `<Tabs id="${index}" :data='${stringifyProp(tabsData)}'${active === -1 ? '' : ` :active="${active}"`}${meta.id ? ` tab-id="${meta.id as string}"` : ''}>
${titles.map((title, titleIndex) =>
`<template #title${titleIndex}="{ value, isActive }">${title}</template>`,
).join('')}`
},
tabsCloseRenderer: () => `\
</Tabs>
`,
tabsCloseRenderer: () => `</Tabs>`,
tabOpenRenderer: ({ index }) =>
`\
<template #tab${index}="{ value, isActive }">
`,
`<template #tab${index}="{ value, isActive }">`,
tabCloseRenderer: () => `\
</template>
`,
tabCloseRenderer: () => `</template>`,
})
}