From aa66f17e0943ce4b2c181ca9bc9a48779c622a8f Mon Sep 17 00:00:00 2001 From: Wee <1275919414@qq.com> Date: Tue, 7 May 2024 23:56:32 +0800 Subject: [PATCH] fix: markdown style bug #55 --- src/components/MarkdownRender.vue | 47 ++++++++++++++++--------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/src/components/MarkdownRender.vue b/src/components/MarkdownRender.vue index 9d78d73..7a5f734 100644 --- a/src/components/MarkdownRender.vue +++ b/src/components/MarkdownRender.vue @@ -46,14 +46,10 @@ const md = new MarkdownIt({ highlightedCode = md.utils.escapeHtml(str); } const encodedCode = btoa(str); - return ` -
${highlightedCode}
-
- `;
+ return `
+
+
+ ${highlightedCode}
`;
},
});
@@ -86,22 +82,27 @@ onMounted(() => {
pre {
margin: 0;
padding: 0;
- .code-actions {
- float: right;
- width: 40px;
- height: 18px;
- display: flex;
- border-radius: 5px;
- .code-action-copy {
- width: 18px;
- height: 18px;
- cursor: pointer;
- margin-right: 5px;
- }
- .code-action-insert {
- width: 18px;
+ code.language-json {
+ position: relative;
+ .code-actions {
+ position: absolute;
+ top: 10px;
+ right: 10px;
height: 18px;
- cursor: pointer;
+ display: flex;
+ border-radius: 5px;
+ .code-action-copy {
+ width: 18px;
+ height: 18px;
+ cursor: pointer;
+ margin-right: 5px;
+ }
+ .code-action-insert {
+ width: 18px;
+ height: 18px;
+ margin-left: 5px;
+ cursor: pointer;
+ }
}
}
}