From e553404b0a55203ebd832ac1a13ac95153145621 Mon Sep 17 00:00:00 2001 From: Guarp Date: Thu, 27 Feb 2025 23:03:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=9C=A8=E7=BA=BF=E7=BB=83?= =?UTF-8?q?=E9=A2=98=E7=A4=BA=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/styles/fonts.css | 4 +- src/components/GeneralRenderer.vue | 17 +++-- src/components/NavBar.vue | 4 +- src/pages/Demos_home.vue | 11 ++- src/pages/demoPages/podExercise/Pod_page.vue | 74 +++++++++++++++++++ .../demoPages/podExercise/QuestionText.vue | 10 +-- src/pages/demoPages/podExercise/Quiz.vue | 62 +++++++++++----- src/router/index.js | 12 ++- 8 files changed, 155 insertions(+), 39 deletions(-) create mode 100644 src/pages/demoPages/podExercise/Pod_page.vue diff --git a/src/assets/styles/fonts.css b/src/assets/styles/fonts.css index 596ae6d..4148d75 100644 --- a/src/assets/styles/fonts.css +++ b/src/assets/styles/fonts.css @@ -1,13 +1,13 @@ @font-face { font-family: 'Netron'; - src: url('../../../public/fonts/Netron.ttf') format('truetype'); + src: url('/public/fonts/Netron.ttf') format('truetype'); font-weight: normal; font-style: normal; font-display: swap; } @font-face { font-family: 'huangkaihua'; - src: url('../../../public/fonts/huangkaihuaLawyerfont-2.ttf') format('truetype'); + src: url('/public/fonts/huangkaihuaLawyerfont-2.ttf') format('truetype'); font-weight: normal; font-style: normal; font-display: swap; diff --git a/src/components/GeneralRenderer.vue b/src/components/GeneralRenderer.vue index 317921e..74e688d 100644 --- a/src/components/GeneralRenderer.vue +++ b/src/components/GeneralRenderer.vue @@ -21,15 +21,22 @@ const formattedLatex = ref(''); // 监听外部内容的变化,并同步更新内部内容 watch(() => props.contentInput, (newValue) => { - localInput.value = newValue.replaceAll('', '$') + localInput.value = newValue; +}); + +function processFormat(text) { + return String(text).replaceAll('', '$') .replaceAll('', '$') .replaceAll('/lt', '<') - .replaceAll('/gt', '>'); -}); + .replaceAll('/gt', '>') + .replaceAll(/(? { - formattedLatex.value = marked.parse(newValue); + formattedLatex.value = marked.parse(processFormat(newValue)); await nextTick(); // 等待 DOM 更新完成 if (window.MathJax) { MathJax.typeset(); // 触发 MathJax 重新渲染公式 @@ -45,7 +52,7 @@ const checkWindowSize = () => { onMounted(async () => { checkWindowSize(); window.addEventListener('resize', checkWindowSize); - formattedLatex.value = marked.parse(localInput.value); + formattedLatex.value = marked.parse(processFormat(localInput.value)); await nextTick(); if (window.MathJax) { MathJax.typeset(); diff --git a/src/components/NavBar.vue b/src/components/NavBar.vue index 0757040..d922bbd 100644 --- a/src/components/NavBar.vue +++ b/src/components/NavBar.vue @@ -53,8 +53,8 @@ const navItems = [ {name: '主页', link: '/'}, 'divider', {name: '博客', link: '/blog'}, - {name: '项目', link: '/projects'}, - // {name: '实例', link: '/demos'}, + // {name: '项目', link: '/projects'}, + {name: '实例', link: '/demos'}, {name: '小工具', link: '/tools'}, {name: '留言板', link: '/demos/board'}, 'divider', diff --git a/src/pages/Demos_home.vue b/src/pages/Demos_home.vue index 37da446..e6674a4 100644 --- a/src/pages/Demos_home.vue +++ b/src/pages/Demos_home.vue @@ -1,14 +1,21 @@ + + + + \ No newline at end of file diff --git a/src/pages/demoPages/podExercise/QuestionText.vue b/src/pages/demoPages/podExercise/QuestionText.vue index 05ae05e..ca05918 100644 --- a/src/pages/demoPages/podExercise/QuestionText.vue +++ b/src/pages/demoPages/podExercise/QuestionText.vue @@ -1,6 +1,6 @@