Disable copy button for bad pre blocks

This commit is contained in:
iBug
2024-05-06 21:16:04 +08:00
parent 4f76c2546a
commit 438710da82
7 changed files with 26 additions and 15 deletions
+2 -2
View File
@@ -5,7 +5,7 @@ permalink: "/docs/history/"
excerpt: Change log of enhancements and bug fixes made to the theme.
sidebar:
nav: docs
last_modified_at: '2024-05-06T21:06:31+08:00'
last_modified_at: '2024-05-06T21:15:29+08:00'
toc: false
---
@@ -19,7 +19,7 @@ toc: false
### Bug Fixes
- Fix copy button going out of range for invalid syntax highlighting blocks.
- Disable copy button on invalid syntax highlighting blocks to avoid positioning issues.
### Enhancements
@@ -21,13 +21,28 @@ if str
end
```
Good (but dumb) highlighting:
```
str = ARGV.first
if str
str = str.b[/\A_(.*)_\z/, 1]
if str and Gem::Version.correct?(str)
version = str
ARGV.shift
end
end
```
Bad highlighting:
```invalid
if Gem.respond_to?(:activate_bin_path)
load Gem.activate_bin_path('jekyll', 'jekyll', version)
else
gem "jekyll", version
load Gem.bin_path("jekyll", "jekyll", version)
str = ARGV.first
if str
str = str.b[/\A_(.*)_\z/, 1]
if str and Gem::Version.correct?(str)
version = str
ARGV.shift
end
end
```