feat: 优化md渲染相关逻辑,优化文章页面

This commit is contained in:
539943419 committed 2025-03-24 12:31:43 +08:00
1 parent e0d967f736
commit 370ec61f3d
5 files changed
+113 -96

No files matched your search

+4 -14
View File
@@ -25,32 +25,22 @@ const VNodeArr = computed(() => {
return () => []
}
const renderedData = markdownIt.render(props.data)
console.log({
renderedData
})
const h2v = new Html2VNode()
h2v.use(
{
filter(tagName) {
return tagName === 'code'
},
rander({
render({
item,
// tagName,
tagAttrs,
// middlewareMap
}) {
// console.log({
// tagName,
// tagAttrs,
// })
const codeType = tagAttrs?.class?.slice(1, -1)?.split('-')?.[1] ?? ''
// console.log({
// codeType,
// })
// @ts-ignore
const inline = (item.children[0].children.trim() as string).includes('\n') ? false : true
console.log({
inline,
c: item.children
})
return h(
codeMirror,
{