Try fixing copy button flying out

This commit is contained in:
iBug 2024-05-06 21:06:32 +08:00
parent 14e3fa2b28
commit 4f76c2546a
5 changed files with 50 additions and 6 deletions

View File

@ -2,6 +2,10 @@
## Unreleased ## Unreleased
### Bug Fixes
- Fix copy button going out of range for invalid syntax highlighting blocks.
### Enhancements ### Enhancements
- Change the icon of a copy button into a tick for 1.5 seconds on successful copy. - Change the icon of a copy button into a tick for 1.5 seconds on successful copy.

View File

@ -139,6 +139,10 @@ 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;

View File

@ -608,6 +608,10 @@ a.reversefootnote {
} }
pre { pre {
&.highlight .clipboard-copy-button {
color: #ffffca;
}
.clipboard-copy-button { .clipboard-copy-button {
display: block; display: block;
position: absolute; position: absolute;
@ -621,14 +625,9 @@ pre {
outline: none; outline: none;
border-radius: 0.1em; border-radius: 0.1em;
padding: 0.2em 0.5em; padding: 0.2em 0.5em;
color: white;
opacity: 0.4; opacity: 0.4;
transition: color 0.25s linear -0.25s, opacity 0.25s linear; transition: color 0.25s linear -0.25s, opacity 0.25s linear;
&:hover {
color: #ffffca;
}
&::before { &::before {
content: ''; content: '';
position: absolute; position: absolute;

View File

@ -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-06T01:20:38+08:00' last_modified_at: '2024-05-06T21:06:31+08:00'
toc: false toc: false
--- ---
@ -17,6 +17,10 @@ toc: false
{% raw %} {% raw %}
## Unreleased ## Unreleased
### Bug Fixes
- Fix copy button going out of range for invalid syntax highlighting blocks.
### Enhancements ### Enhancements
- Change the icon of a copy button into a tick for 1.5 seconds on successful copy. - Change the icon of a copy button into a tick for 1.5 seconds on successful copy.

View File

@ -0,0 +1,33 @@
---
title: "Edge Case: Invalid syntax highlight languages"
categories:
- Edge Case
tags:
- content
- css
- edge case
---
Good highlighting:
```ruby
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)
end
```