From 9f2bed804edb18f5fca4ed27a2121943c64c6022 Mon Sep 17 00:00:00 2001 From: mayx Date: Thu, 17 Apr 2025 03:51:49 +0000 Subject: [PATCH] Update 5 files - /_config.yml - /assets/css/style.scss - /assets/js/main.js - /_layouts/default.html - /_layouts/post.html --- _config.yml | 7 +++++++ _layouts/default.html | 2 +- _layouts/post.html | 2 -- assets/css/style.scss | 15 +++++++++++++++ assets/js/main.js | 2 +- 5 files changed, 24 insertions(+), 4 deletions(-) diff --git a/_config.yml b/_config.yml index 7cab47c..87494a1 100644 --- a/_config.yml +++ b/_config.yml @@ -7,6 +7,13 @@ description: Mayx's Home Page timezone: Asia/Shanghai excerpt_separator: paginate: 7 +kramdown: + syntax_highlighter_opts: + span: + line_numbers: false + block: + line_numbers: true + start_line: 1 plugins: - jekyll-sitemap - jekyll-feed diff --git a/_layouts/default.html b/_layouts/default.html index 7dd847f..303c26f 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -129,7 +129,7 @@ diff --git a/_layouts/post.html b/_layouts/post.html index 2207fae..a1e72b5 100644 --- a/_layouts/post.html +++ b/_layouts/post.html @@ -26,7 +26,6 @@ layout: default
{% if page.layout != "encrypt" %} - AI摘要

{% assign ai_cache = site.data.ai-cache[page.url] %}{% if ai_cache %}{{ ai_cache }}{% else %}正在生成中……{% endif %}

{% unless ai_cache %} @@ -72,7 +71,6 @@ layout: default {% endunless %}
- {% endif %} {% include toc.html html=content sanitize=true h_max=3 %} diff --git a/assets/css/style.scss b/assets/css/style.scss index b59d669..5d7a616 100644 --- a/assets/css/style.scss +++ b/assets/css/style.scss @@ -99,4 +99,19 @@ div.highlight button:active, div.highlight button:focus, div.highlight button:hover { opacity: 1 +} + +table.rouge-table { + margin: 0; +} + +td.rouge-gutter, +td.rouge-code { + padding: 0; + border-bottom: none; +} + +pre.lineno { + padding: 0 10px 0 0; + border: none; } \ No newline at end of file diff --git a/assets/js/main.js b/assets/js/main.js index faac621..72fe6f0 100644 --- a/assets/js/main.js +++ b/assets/js/main.js @@ -88,7 +88,7 @@ codeBlocks.forEach(function (codeBlock) { codeBlock.append(copyButton); copyButton.addEventListener('click', function () { - var code = codeBlock.querySelector('pre code').innerText.trim(); + var code = codeBlock.querySelector('.rouge-code pre').innerText.trim(); window.navigator.clipboard.writeText(code) .then(() => { copyButton.innerText = '✅';