Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
63638ce4
authored
May 21, 2024
by
cherishsince
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【优化】try mkardown 组件异常,因为 stream 模型可能返回的信息不全
parent
a96a2ec9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletions
+6
-1
src/components/MarkdownView/index.vue
+6
-1
No files found.
src/components/MarkdownView/index.vue
View file @
63638ce4
...
@@ -20,7 +20,12 @@ const contentRef = ref()
...
@@ -20,7 +20,12 @@ const contentRef = ref()
// marked 渲染器
// marked 渲染器
const
renderer
=
{
const
renderer
=
{
code
(
code
,
language
,
c
)
{
code
(
code
,
language
,
c
)
{
const
highlightHtml
=
hljs
.
highlight
(
code
,
{
language
:
language
,
ignoreIllegals
:
true
}).
value
let
highlightHtml
try
{
highlightHtml
=
hljs
.
highlight
(
code
,
{
language
:
language
,
ignoreIllegals
:
true
}).
value
}
catch
(
e
)
{
// skip
}
const
copyHtml
=
`<div id="copy" data-copy='
${
code
}
' style="position: absolute; right: 10px; top: 5px; color: #fff;cursor: pointer;">复制</div>`
const
copyHtml
=
`<div id="copy" data-copy='
${
code
}
' style="position: absolute; right: 10px; top: 5px; color: #fff;cursor: pointer;">复制</div>`
return
`<pre style="position: relative;">
${
copyHtml
}
<code class="hljs">
${
highlightHtml
}
</code></pre>`
return
`<pre style="position: relative;">
${
copyHtml
}
<code class="hljs">
${
highlightHtml
}
</code></pre>`
}
}
...
...
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