Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support config.codeblock.copy_button.style.mac with prismjs #227

Closed
ghost opened this issue Mar 12, 2021 · 4 comments
Closed

Support config.codeblock.copy_button.style.mac with prismjs #227

ghost opened this issue Mar 12, 2021 · 4 comments
Labels
Wontfix This will not be worked on

Comments

@ghost
Copy link

ghost commented Mar 12, 2021

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch hexo-theme-next@8.2.2 for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/hexo-theme-next/source/css/_common/scaffolding/highlight/copy-code.styl b/node_modules/hexo-theme-next/source/css/_common/scaffolding/highlight/copy-code.styl
index 1b0651e..b87fe9a 100644
--- a/node_modules/hexo-theme-next/source/css/_common/scaffolding/highlight/copy-code.styl
+++ b/node_modules/hexo-theme-next/source/css/_common/scaffolding/highlight/copy-code.styl
@@ -18,7 +18,11 @@
     right: 0;
     top: 0;
   } else if (hexo-config('codeblock.copy_button.style') == 'mac') {
-    color: var(--highlight-foreground);
+    if (hexo-config('prism.enable')) {
+      color: grey;
+    } else {
+      color: var(--highlight-foreground);
+    }
     font-size: 14px;
     right: 0;
     top: 2px;
@@ -34,10 +38,17 @@
 }
 
 if (hexo-config('codeblock.copy_button.style') == 'mac') {
-  figure.highlight {
+  figure.highlight, pre[class*="language-"] {
     border-radius: 5px;
-    box-shadow: 0 10px 30px 0 rgba(0, 0, 0, .4);
-    padding-top: 30px;
+
+    // Remove shadow, so clear, comfortable
+    // box-shadow: 0 10px 30px 0 rgba(0, 0, 0, .4);
+
+    if (hexo-config('prism.enable')) {
+      padding-top: 2em;
+    } else {
+      padding-top: 30px;
+    }
 
     .table-container {
       border-radius: 0 0 5px 5px;
@@ -47,7 +58,13 @@ if (hexo-config('codeblock.copy_button.style') == 'mac') {
       background: #fc625d;
       box-shadow: 20px 0 #fdbc40, 40px 0 #35cd4b;
       left: 12px;
-      margin-top: -20px;
+
+      if (hexo-config('prism.enable')) {
+        margin-top: -24px;
+      } else {
+        margin-top: -20px;
+      }
+
       position: absolute;
       round-icon(12px);
     }

This issue body was partially generated by patch-package.

@welcome
Copy link

welcome bot commented Mar 12, 2021

Thanks for opening this issue, maintainers will get back to you as soon as possible!

@ghost ghost changed the title Add config.prismjs.copy_button.style.mac Add config.codeblock.copy_button.style.mac Mar 12, 2021
@ghost ghost closed this as completed Mar 12, 2021
@stevenjoezhang stevenjoezhang added Feature Request New feature or request and removed To Do labels Nov 27, 2021
@stevenjoezhang stevenjoezhang added Wontfix This will not be worked on and removed Feature Request New feature or request labels Mar 7, 2022
@github-actions
Copy link

github-actions bot commented Mar 7, 2022

This will not be worked on but we appreciate your contribution.

@github-actions github-actions bot closed this as completed Mar 7, 2022
@stevenjoezhang
Copy link
Member

Most prism themes has its own code block border style, which conflicts with copy_button.style.mac. Thus we are not planned to support it.

@stevenjoezhang stevenjoezhang changed the title Add config.codeblock.copy_button.style.mac Support config.codeblock.copy_button.style.mac with prismjs Mar 7, 2022
@github-actions
Copy link

github-actions bot commented Mar 8, 2023

This thread has been automatically locked since there has not been any recent activity after it was closed. It is possible issue was solved or at least outdated. Feel free to open new for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

1 participant