🚧 Change the code block style settings.
This commit is contained in:
parent
748c44e25d
commit
b9cd603c04
@ -1,6 +1,3 @@
|
||||
.highlight:hover .copy-btn, pre:hover .copy-btn {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.highlight {
|
||||
|
||||
@ -15,38 +12,45 @@
|
||||
}
|
||||
}
|
||||
|
||||
.copy-btn {
|
||||
color: $black-dim;
|
||||
cursor: pointer;
|
||||
line-height: 1.6;
|
||||
opacity: 0;
|
||||
padding: 2px 6px;
|
||||
position: absolute;
|
||||
right: 8px;
|
||||
top: 4px;
|
||||
transition: opacity $transition-ease;
|
||||
background: var(--highlight-background);
|
||||
@if $codeblock_copy_btn_enable {
|
||||
|
||||
@if $codeblock_copy_btn_style == 'flat' {
|
||||
background: white;
|
||||
border: 0;
|
||||
font-size: $font-size-smaller;
|
||||
.highlight:hover .copy-btn, pre:hover .copy-btn {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
} @else if $codeblock_copy_btn_style == 'mac' {
|
||||
color: var(--highlight-foreground);
|
||||
font-size: 14px;
|
||||
border-radius: 3px;
|
||||
} @else {
|
||||
background-color: $gainsboro;
|
||||
background-image: linear-gradient(#fcfcfc, $gainsboro);
|
||||
border: 1px solid #d5d5d5;
|
||||
border-radius: 3px;
|
||||
font-size: $font-size-smaller;
|
||||
.copy-btn {
|
||||
color: $black-dim;
|
||||
cursor: pointer;
|
||||
line-height: 1.6;
|
||||
opacity: 0;
|
||||
padding: 2px 6px;
|
||||
position: absolute;
|
||||
right: 8px;
|
||||
top: 4px;
|
||||
transition: opacity $transition-ease;
|
||||
background: var(--highlight-background);
|
||||
|
||||
@if $codeblock_style == 'flat' {
|
||||
background: white;
|
||||
border: 0;
|
||||
font-size: $font-size-smaller;
|
||||
|
||||
} @else if $codeblock_style == 'mac' {
|
||||
color: var(--highlight-foreground);
|
||||
font-size: 14px;
|
||||
border-radius: 3px;
|
||||
} @else {
|
||||
background-color: $gainsboro;
|
||||
background-image: linear-gradient(#fcfcfc, $gainsboro);
|
||||
border: 1px solid #d5d5d5;
|
||||
border-radius: 3px;
|
||||
font-size: $font-size-smaller;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@if $codeblock_copy_btn_style == 'mac' {
|
||||
@if $codeblock_style == 'mac' {
|
||||
.highlight {
|
||||
border-radius: 5px;
|
||||
box-shadow: 0 10px 30px 0 rgba(0, 0, 0, .4);
|
||||
|
@ -52,7 +52,8 @@ $highlight_dark_foreground : #fff;
|
||||
$highlight_light_background : #565656;
|
||||
$highlight_light_foreground : #fff;
|
||||
|
||||
$codeblock_copy_btn_style : {{ $P.codeblock.copyBtn.style }};
|
||||
$codeblock_copy_btn_enable : {{ $P.codeblock.copyBtn }};
|
||||
$codeblock_style : {{ $P.codeblock.style }};
|
||||
|
||||
// Sidebar
|
||||
$sidebar_offset : {{ $P.sidebar.offset }};
|
||||
@ -113,7 +114,9 @@ $reading_progress_reversed : {{ $P.readingProgress.reversed }};
|
||||
|
||||
// Thirdparty
|
||||
$math_mathjax_enable : {{ $P.math.mathjax.enable }};
|
||||
$related_posts_enable : {{ $P.relatedPosts.enable }};
|
||||
// TODO
|
||||
//$related_posts_enable : {{ $P.relatedPosts.enable }};
|
||||
$related_posts_enable : false;
|
||||
$pdf_enable : {{ $P.pdf.enable }};
|
||||
$pdf_height : {{ $P.pdf.height }};
|
||||
|
||||
|
@ -10,7 +10,7 @@ if (!window.NexT) window.NexT = {};
|
||||
"darkmode" : {{ .Site.Params.darkmode }},
|
||||
"version" : "{{ .Site.Data.config.version }}",
|
||||
"sidebar" : {{ .Site.Params.sidebar | jsonify }},
|
||||
"copycode" : {{ .Site.Params.codeblock.copyBtn | jsonify }},
|
||||
"copybtn" : {{ .Site.Params.codeblock.copyBtn }},
|
||||
"bookmark" : {{ .Site.Params.bookmark | jsonify }},
|
||||
"comments" : {{ .Site.Params.comments | jsonify }},
|
||||
"mediumzoom" : {{ .Site.Params.mediumzoom }},
|
||||
|
@ -45,7 +45,7 @@ NexT.boot.refresh = function() {
|
||||
CONFIG.pangu && window.pangu.spacingPage();
|
||||
|
||||
CONFIG.isPage && NexT.utils.replacePostCRLink();
|
||||
CONFIG.isPage && NexT.utils.registerCopyCode();
|
||||
CONFIG.isPage && CONFIG.copybtn && NexT.utils.registerCopyCode();
|
||||
NexT.utils.registerTabsTag();
|
||||
/*NexT.utils.registerActiveMenuItem();
|
||||
NexT.utils.registerLangSelect();*/
|
||||
|
@ -41,7 +41,7 @@ NexT.utils = {
|
||||
*/
|
||||
registerCopyCode: function() {
|
||||
let figure = document.querySelectorAll('.highlight pre');
|
||||
if (figure.length === 0 || !CONFIG.copycode) return;
|
||||
if (figure.length === 0 || !CONFIG.copybtn) return;
|
||||
figure.forEach(element => {
|
||||
let cn = element.querySelector('code').className;
|
||||
// TODO seems hard code need find other ways fixed it.
|
||||
|
Loading…
Reference in New Issue
Block a user