build: rename `code-block-tools` -> `code-block`
This commit is contained in:
parent
39b82e84e7
commit
e56f5718d2
|
@ -153,10 +153,10 @@ post:
|
|||
custom_label_list: ["Trainee", "Engineer", "Architect"]
|
||||
|
||||
# ---------------------------------------------------------------------------------------
|
||||
# Code block tools
|
||||
# Code block
|
||||
# Support code copy and code block collapse
|
||||
# ---------------------------------------------------------------------------------------
|
||||
code_block_tools:
|
||||
code_block:
|
||||
enable: false # Option values: true | false
|
||||
style: default # Option values: default | mac
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
const {
|
||||
local_search: t_local_search,
|
||||
code_copy: t_code_copy,
|
||||
code_block_tools: t_code_block_tools,
|
||||
code_block: t_code_block,
|
||||
lazyload: t_lazyload,
|
||||
toc: t_toc,
|
||||
pjax: t_pjax
|
||||
|
@ -21,8 +21,8 @@ const {
|
|||
<%- __js('js/local-search.js') %>
|
||||
<% } %>
|
||||
|
||||
<% if (t_code_block_tools?.enable === true || t_code_copy?.enable === true) { %>
|
||||
<%- __js('js/code-block-tools.js') %>
|
||||
<% if (t_code_block?.enable === true || t_code_copy?.enable === true) { %>
|
||||
<%- __js('js/code-block.js') %>
|
||||
<% } %>
|
||||
|
||||
<% if (t_lazyload?.enable === true) { %>
|
||||
|
|
|
@ -40,7 +40,7 @@ hexo.extend.helper.register('export_config', function () {
|
|||
style: theme.style || {},
|
||||
local_search: theme.local_search || {},
|
||||
code_copy: theme.code_copy || {},
|
||||
code_block_tools: theme.code_block_tools || {},
|
||||
code_block: theme.code_block || {},
|
||||
side_tools: theme.side_tools || {},
|
||||
pjax: theme.pjax || {},
|
||||
lazyload: theme.lazyload || {},
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
}
|
||||
|
||||
|
||||
if (hexo-config('code_block_tools.style') == 'mac' || hexo-config('code_copy.style') == 'mac') {
|
||||
if (hexo-config('code_block.style') == 'mac' || hexo-config('code_copy.style') == 'mac') {
|
||||
margin 1.4rem 0 1.8rem 0
|
||||
box-shadow 0 0.8rem 2rem 0 rgba(0, 0, 0, 0.4)
|
||||
|
|
@ -17,38 +17,38 @@ $highlight-purple = #8959a8
|
|||
$highlight-deletion = #fdd
|
||||
$highlight-addition = #dfd
|
||||
|
||||
$night-code-foreground = lighten($dark-text-color-3, 2%)
|
||||
$night-code-background = darken($dark-background-color-1, 10%)
|
||||
$night-highlight-foreground = lighten($dark-text-color-3, 2%)
|
||||
$night-highlight-background = darken($dark-background-color-1, 8%)
|
||||
$night-highlight-gutter-color = lighten($dark-text-color-3, 5%)
|
||||
$night-highlight-gutter-bg-color = darken($dark-background-color-1, 10%)
|
||||
$night-highlight-comment = #969896
|
||||
$night-highlight-red = #cc6666
|
||||
$night-highlight-orange = #de935f
|
||||
$night-highlight-yellow = #f0c674
|
||||
$night-highlight-green = #b5bd68
|
||||
$night-highlight-aqua = #8abeb7
|
||||
$night-highlight-blue = #81a2be
|
||||
$night-highlight-purple = #b294bb
|
||||
$night-highlight-deletion = #008000
|
||||
$night-highlight-addition = #800000
|
||||
$dark-code-foreground = lighten($dark-text-color-3, 2%)
|
||||
$dark-code-background = darken($dark-background-color-1, 10%)
|
||||
$dark-highlight-foreground = lighten($dark-text-color-3, 2%)
|
||||
$dark-highlight-background = darken($dark-background-color-1, 8%)
|
||||
$dark-highlight-gutter-color = lighten($dark-text-color-3, 5%)
|
||||
$dark-highlight-gutter-bg-color = darken($dark-background-color-1, 10%)
|
||||
$dark-highlight-comment = #969896
|
||||
$dark-highlight-red = #cc6666
|
||||
$dark-highlight-orange = #de935f
|
||||
$dark-highlight-yellow = #f0c674
|
||||
$dark-highlight-green = #b5bd68
|
||||
$dark-highlight-aqua = #8abeb7
|
||||
$dark-highlight-blue = #81a2be
|
||||
$dark-highlight-purple = #b294bb
|
||||
$dark-highlight-deletion = #008000
|
||||
$dark-highlight-addition = #800000
|
||||
|
||||
code-theme(mode) {
|
||||
--code-foreground mode == 'light' ? $code-foreground : $night-code-foreground
|
||||
--code-background mode == 'light' ? $code-background : $night-code-background
|
||||
--highlight-background mode == 'light' ? $highlight-background : $night-highlight-background
|
||||
--highlight-foreground mode == 'light' ? $highlight-foreground : $night-highlight-foreground
|
||||
--highlight-comment mode == 'light' ? $highlight-comment : $night-highlight-comment
|
||||
--highlight-red mode == 'light' ? $highlight-red : $night-highlight-red
|
||||
--highlight-orange mode == 'light' ? $highlight-orange : $night-highlight-orange
|
||||
--highlight-yellow mode == 'light' ? $highlight-yellow : $night-highlight-yellow
|
||||
--highlight-green mode == 'light' ? $highlight-green : $night-highlight-green
|
||||
--highlight-aqua mode == 'light' ? $highlight-aqua : $night-highlight-aqua
|
||||
--highlight-blue mode == 'light' ? $highlight-blue : $night-highlight-blue
|
||||
--highlight-purple mode == 'light' ? $highlight-purple : $night-highlight-purple
|
||||
--highlight-gutter-color mode == 'light' ? $highlight-gutter-color : $night-highlight-gutter-color
|
||||
--highlight-gutter-bg-color mode == 'light' ? $highlight-gutter-bg-color : $night-highlight-gutter-bg-color
|
||||
--code-foreground mode == 'light' ? $code-foreground : $dark-code-foreground
|
||||
--code-background mode == 'light' ? $code-background : $dark-code-background
|
||||
--highlight-background mode == 'light' ? $highlight-background : $dark-highlight-background
|
||||
--highlight-foreground mode == 'light' ? $highlight-foreground : $dark-highlight-foreground
|
||||
--highlight-comment mode == 'light' ? $highlight-comment : $dark-highlight-comment
|
||||
--highlight-red mode == 'light' ? $highlight-red : $dark-highlight-red
|
||||
--highlight-orange mode == 'light' ? $highlight-orange : $dark-highlight-orange
|
||||
--highlight-yellow mode == 'light' ? $highlight-yellow : $dark-highlight-yellow
|
||||
--highlight-green mode == 'light' ? $highlight-green : $dark-highlight-green
|
||||
--highlight-aqua mode == 'light' ? $highlight-aqua : $dark-highlight-aqua
|
||||
--highlight-blue mode == 'light' ? $highlight-blue : $dark-highlight-blue
|
||||
--highlight-purple mode == 'light' ? $highlight-purple : $dark-highlight-purple
|
||||
--highlight-gutter-color mode == 'light' ? $highlight-gutter-color : $dark-highlight-gutter-color
|
||||
--highlight-gutter-bg-color mode == 'light' ? $highlight-gutter-bg-color : $dark-highlight-gutter-bg-color
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
@import "common/basic.styl"
|
||||
@import "common/markdown.styl"
|
||||
@import "common/code-block/highlight.styl"
|
||||
@import "common/code-block/code-block-tools.styl"
|
||||
@import "common/code-block/code-block.styl"
|
||||
@import "common/code-block/code-theme.styl"
|
||||
@import "layout/page.styl"
|
||||
@import "layout/_partial/local-search.styl"
|
||||
|
|
|
@ -8,7 +8,7 @@ KEEP.initCodeBlockTools = () => {
|
|||
}
|
||||
|
||||
const { style: codeCopyStyle } = KEEP.theme_config?.code_copy
|
||||
const { style: codeBlockStyle } = KEEP.theme_config?.code_block_tools
|
||||
const { style: codeBlockStyle } = KEEP.theme_config?.code_block
|
||||
const isMac = (codeBlockStyle || codeCopyStyle || 'default') === 'mac'
|
||||
const foldedIconClassName = isMac ? 'fas fa-chevron-left' : 'fas fa-chevron-right'
|
||||
const {
|
|
@ -1,7 +1,7 @@
|
|||
/* global KEEP */
|
||||
|
||||
window.addEventListener('DOMContentLoaded', () => {
|
||||
const { version, local_search, code_block_tools, code_copy, lazyload } = KEEP.theme_config
|
||||
const { version, local_search, code_block, code_copy, lazyload } = KEEP.theme_config
|
||||
|
||||
KEEP.themeInfo = {
|
||||
theme: `Keep v${version}`,
|
||||
|
@ -56,7 +56,7 @@ window.addEventListener('DOMContentLoaded', () => {
|
|||
KEEP.initLocalSearch()
|
||||
}
|
||||
|
||||
if (code_block_tools?.enable === true || code_copy?.enable === true) {
|
||||
if (code_block?.enable === true || code_copy?.enable === true) {
|
||||
KEEP.initCodeBlockTools()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue