From 4f04f73dccb047f1835d3770dbcca508d07466b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A3=9E=E9=9B=AA=E6=97=A0=E6=83=85?= Date: Thu, 1 Sep 2022 12:16:23 +0800 Subject: [PATCH] support copy code,close #91 --- README.md | 2 +- layouts/partials/copy_button.html | 76 +++++++++++++++++++++++++++++++ layouts/partials/footer.html | 2 + static/css/style.css | 9 +--- 4 files changed, 81 insertions(+), 8 deletions(-) create mode 100644 layouts/partials/copy_button.html diff --git a/README.md b/README.md index 57b3b1f..1a6fb96 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Maupassant theme, ported to Hugo. 8. 支持文章按年份日期进行归档 9. 支持GA分析统计 17. 不蒜子页面计数器支持 -11. 代码高亮、代码行号 +11. 代码高亮、代码行号、代码拷贝 10. sitemap站点地图 5. RSS支持,并且可以自动发现RSS 14. Google站内搜索 diff --git a/layouts/partials/copy_button.html b/layouts/partials/copy_button.html new file mode 100644 index 0000000..2e2fec8 --- /dev/null +++ b/layouts/partials/copy_button.html @@ -0,0 +1,76 @@ +{{- if (and (eq .Kind "page") (in (slice "post" "posts") .Type)) }} + + +{{- end }} \ No newline at end of file diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index d5075d9..4ca0311 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -136,6 +136,8 @@ {{ template "_internal/google_analytics.html" . }} {{- end -}} +{{ partial "copy_button" . }} + {{ if .Site.Params.busuanzi }} {{ end }} diff --git a/static/css/style.css b/static/css/style.css index 6cc45f0..4a0912c 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -15,7 +15,6 @@ [class^="icon-"], [class*=" icon-"] { font-family: 'icomoon'; - speak: none; font-style: normal; font-weight: normal; font-variant: normal; @@ -98,13 +97,12 @@ mark { padding: 3px 3px 3px 5px; background: #fffdd1; } -pre, code { - font-family:Menlo, Monaco, Consolas, "Lucida Console", "Courier New", monospace; -} pre { + font-family:Menlo, Monaco, Consolas, "Lucida Console", "Courier New", monospace; overflow:auto; border: 1px solid #ddd; display: block; + margin: 0px; } code { display: inline-block; @@ -220,8 +218,6 @@ textarea { #nav-menu a:first-child { border:none; } -#nav-menu a:hover { -} #nav-menu a.current { border:1px solid #ddd; border-bottom:1px solid #fff; @@ -1039,7 +1035,6 @@ table tr:nth-child(2n) { table tr { border: 0; - border-top: 1px solid #CCC; background-color: white; }