Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
poc-fe
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
poc
poc-fe
Commits
44c21984
Commit
44c21984
authored
Apr 30, 2025
by
tyyin lan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: 代码渲染块主题更换
parent
4e741dcf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
6 deletions
+15
-6
markdown-render.vue
src/components/markdown-render/markdown-render.vue
+15
-6
No files found.
src/components/markdown-render/markdown-render.vue
View file @
44c21984
...
@@ -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
:
fals
e
,
darkTheme
:
tru
e
,
})
})
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
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment