diff --git a/_config.yml b/_config.yml index 8d17857..36b6a3b 100755 --- a/_config.yml +++ b/_config.yml @@ -78,12 +78,6 @@ TianliGpt: wiki: true api: 5Q5mpqRK5DkwT1X9Gi5e -# 代码块 -CodeBlock: - show_copy: true - default_text: 'copy' - success_text: 'copied' - search: service: local_search # local_search, todo... local_search: # 在 front-matter 中设置 indexing:false 来避免被搜索索引 @@ -366,6 +360,13 @@ plugins: # 推荐使用 dark 主题 在夜间模式下显示效果更好 theme: dark + # 代码块复制按钮 + copycode: + enable: true + js: /js/plugins/copycode.js + default_text: 'Copy' + success_text: 'Copied' + style: darkmode: auto # auto / always / false smooth_scroll: true # true / false diff --git a/layout/_partial/main/copycode.ejs b/layout/_partial/main/copycode.ejs deleted file mode 100644 index 557d0da..0000000 --- a/layout/_partial/main/copycode.ejs +++ /dev/null @@ -1,86 +0,0 @@ -<% if (theme.CodeBlock.show_copy) { %> - - - -<% } %> - diff --git a/layout/_partial/scripts/index.ejs b/layout/_partial/scripts/index.ejs index 02cdded..4e58315 100644 --- a/layout/_partial/scripts/index.ejs +++ b/layout/_partial/scripts/index.ejs @@ -143,6 +143,9 @@ if ('<%- theme.plugins.heti.enable %>' == 'true') { stellar.plugins.heti = Object.assign(<%- JSON.stringify(theme.plugins.heti) %>); } + if ('<%- theme.plugins.copycode.enable %>' == 'true') { + stellar.plugins.copycode = Object.assign(<%- JSON.stringify(theme.plugins.copycode) %>); + } diff --git a/layout/layout.ejs b/layout/layout.ejs index c2daa04..1e1e36b 100755 --- a/layout/layout.ejs +++ b/layout/layout.ejs @@ -16,7 +16,6 @@