From 370ec61f3d23940bf97a39eba7b947c1be04c643 Mon Sep 17 00:00:00 2001 From: Miao_Spring <539943419@qq.com> Date: Mon, 24 Mar 2025 12:31:43 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96md=E6=B8=B2=E6=9F=93?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E9=80=BB=E8=BE=91=EF=BC=8C=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E6=96=87=E7=AB=A0=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/markdownRender.vue | 18 ++------ pages/posts/index.vue | 43 +++++++++---------- pages/posts/post-[id].vue | 80 +++++++++++++++-------------------- pages/user/main/index.vue | 53 ++++++++++++++++++++--- utils/html2VNode.ts | 15 ++++--- 5 files changed, 113 insertions(+), 96 deletions(-) diff --git a/components/markdownRender.vue b/components/markdownRender.vue index 2a0bef0..52e07d6 100644 --- a/components/markdownRender.vue +++ b/components/markdownRender.vue @@ -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, { diff --git a/pages/posts/index.vue b/pages/posts/index.vue index 0675217..14c384a 100644 --- a/pages/posts/index.vue +++ b/pages/posts/index.vue @@ -1,6 +1,6 @@