Commit 44c21984 authored by tyyin lan's avatar tyyin lan

chore: 代码渲染块主题更换

parent 4e741dcf
...@@ -6,7 +6,8 @@ import 'katex/dist/katex.min.css' ...@@ -6,7 +6,8 @@ import 'katex/dist/katex.min.css'
import { throttle, debounce } from 'lodash-es' import { throttle, debounce } from 'lodash-es'
import DOMPurify from 'dompurify' import DOMPurify from 'dompurify'
import hljs from 'highlight.js' import hljs from 'highlight.js'
import 'highlight.js/styles/panda-syntax-light.css' // import 'highlight.js/styles/panda-syntax-light.css'
import 'highlight.js/styles/atom-one-dark.min.css'
import './style/github-markdown.css' import './style/github-markdown.css'
import markedKatex, { MarkedKatexOptions } from 'marked-katex-extension' import markedKatex, { MarkedKatexOptions } from 'marked-katex-extension'
import { copyToClip } from '@/utils/copy' import { copyToClip } from '@/utils/copy'
...@@ -23,7 +24,7 @@ const props = withDefaults(defineProps<Props>(), { ...@@ -23,7 +24,7 @@ const props = withDefaults(defineProps<Props>(), {
rawTextContent: '', rawTextContent: '',
fontSize: '14px', fontSize: '14px',
color: '#333', color: '#333',
darkTheme: false, darkTheme: true,
}) })
const katexOptions: MarkedKatexOptions = { const katexOptions: MarkedKatexOptions = {
...@@ -174,7 +175,7 @@ defineExpose({ ...@@ -174,7 +175,7 @@ defineExpose({
<div ref="markdownRenderContainerRef" class="markdown-render-container"> <div ref="markdownRenderContainerRef" class="markdown-render-container">
<article <article
class="markdown-body markdown-render-inner" class="markdown-body markdown-render-inner"
data-theme="dark" :data-theme="darkTheme ? 'dark' : 'light'"
:style="articleContainerStyle" :style="articleContainerStyle"
v-html="renderTextContent" v-html="renderTextContent"
/> />
...@@ -204,9 +205,12 @@ defineExpose({ ...@@ -204,9 +205,12 @@ defineExpose({
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
padding: 8px 16px; padding: 8px 16px;
color: v-bind('props.darkTheme ? "#fff" : "#ccc"'); color: v-bind('props.darkTheme ? "#fff" : "#333"');
user-select: none; user-select: none;
background-color: v-bind('props.darkTheme ? "#484a4b" : "#f1f1f1"'); background-color: v-bind('props.darkTheme ? "#323740" : "#EEEEEE"');
// background-color: v-bind('props.darkTheme ? "#484a4b" : "#EEEEEE"');
// background-color: v-bind('props.darkTheme ? "#333842" : "#EEEEEE"');
.language { .language {
display: flex; display: flex;
...@@ -258,7 +262,12 @@ defineExpose({ ...@@ -258,7 +262,12 @@ defineExpose({
:deep(.markdown-body) { :deep(.markdown-body) {
&[data-theme='dark'] { &[data-theme='dark'] {
/* stylelint-disable-next-line custom-property-pattern */ /* stylelint-disable-next-line custom-property-pattern */
--bgColor-muted: #1d1e1f; --bgColor-muted: #282c34;
}
&[data-theme='light'] {
/* stylelint-disable-next-line custom-property-pattern */
--bgColor-muted: #fdfdfd;
} }
& .code-container-wrapper { & .code-container-wrapper {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment