Disable copy button for bad pre blocks
This commit is contained in:
parent
4f76c2546a
commit
438710da82
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
### Bug Fixes
|
### 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
|
### Enhancements
|
||||||
|
|
||||||
|
@ -139,10 +139,6 @@ body {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pre {
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
:not(pre) > code {
|
:not(pre) > code {
|
||||||
padding-top: 0.1rem;
|
padding-top: 0.1rem;
|
||||||
padding-bottom: 0.1rem;
|
padding-bottom: 0.1rem;
|
||||||
|
@ -206,7 +206,7 @@ $(document).ready(function () {
|
|||||||
|
|
||||||
if (window.enable_copy_code_button) {
|
if (window.enable_copy_code_button) {
|
||||||
document
|
document
|
||||||
.querySelectorAll(".page__content pre > code")
|
.querySelectorAll(".page__content pre.highlight > code")
|
||||||
.forEach(function (element, index, parentList) {
|
.forEach(function (element, index, parentList) {
|
||||||
// Locate the <pre> element
|
// Locate the <pre> element
|
||||||
var container = element.parentElement;
|
var container = element.parentElement;
|
||||||
|
2
assets/js/main.min.js
vendored
2
assets/js/main.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -5,7 +5,7 @@ permalink: "/docs/history/"
|
|||||||
excerpt: Change log of enhancements and bug fixes made to the theme.
|
excerpt: Change log of enhancements and bug fixes made to the theme.
|
||||||
sidebar:
|
sidebar:
|
||||||
nav: docs
|
nav: docs
|
||||||
last_modified_at: '2024-05-06T21:06:31+08:00'
|
last_modified_at: '2024-05-06T21:15:29+08:00'
|
||||||
toc: false
|
toc: false
|
||||||
---
|
---
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ toc: false
|
|||||||
|
|
||||||
### Bug Fixes
|
### 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
|
### Enhancements
|
||||||
|
|
||||||
|
@ -21,13 +21,28 @@ if str
|
|||||||
end
|
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:
|
Bad highlighting:
|
||||||
|
|
||||||
```invalid
|
```invalid
|
||||||
if Gem.respond_to?(:activate_bin_path)
|
str = ARGV.first
|
||||||
load Gem.activate_bin_path('jekyll', 'jekyll', version)
|
if str
|
||||||
else
|
str = str.b[/\A_(.*)_\z/, 1]
|
||||||
gem "jekyll", version
|
if str and Gem::Version.correct?(str)
|
||||||
load Gem.bin_path("jekyll", "jekyll", version)
|
version = str
|
||||||
|
ARGV.shift
|
||||||
|
end
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user