jekyll-github-code 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -2
- data/README.md +15 -11
- data/assets/css/{github-code.scss → github-code.css} +2 -5
- data/assets/js/github-code.js +0 -1
- data/lib/jekyll-github-code/generator.rb +73 -0
- data/lib/jekyll-github-code/version.rb +1 -1
- data/lib/jekyll-github-code.rb +3 -0
- metadata +8 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1528b23a3cae07ee662558e4f84c366fa30a586c9abc3c51692871ed91cf498c
|
|
4
|
+
data.tar.gz: 9a859be4d4bae3d2bf1f0b41e1d9e8176e031898d1c583f04ebb5a01cafd0050
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ef44a7f951c544fe674018a9ed9f83fdc30d45a01d969663d8603a47a87ad165f50e146ed0c4ae8c1669a84c0b673e5fdfaf553ac659a4182e2f780ea3e2d1fc
|
|
7
|
+
data.tar.gz: bd8e2f4d06614fd5e9353ebaa382e9bdf21f33efe7ea910d17e028a5ac6204e4eb7826ca56a38d8e69206044589274655791cc43eafd6c1ca773a3694b4051c9
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.2.0] - 2025-12-12
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- Automatic asset generation (CSS and JS copied to `_site/assets/github-code/`)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
8
15
|
## [0.1.0] - 2025-12-12
|
|
9
16
|
|
|
10
17
|
### Added
|
|
@@ -17,7 +24,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
17
24
|
- Automatic language detection based on file extension
|
|
18
25
|
- Copy-to-clipboard button
|
|
19
26
|
- Clickable filename linking to GitHub
|
|
20
|
-
- Dark and light theme support
|
|
27
|
+
- Dark and light theme support (multiple theme systems supported)
|
|
21
28
|
- Compatible with Jekyll Chirpy theme
|
|
22
29
|
- Comprehensive test suite
|
|
23
|
-
|
data/README.md
CHANGED
|
@@ -44,26 +44,30 @@ plugins:
|
|
|
44
44
|
- jekyll-github-code
|
|
45
45
|
```
|
|
46
46
|
|
|
47
|
-
###
|
|
47
|
+
### Include the Assets
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
The plugin automatically copies CSS and JS files to your site's `_site/assets/github-code/` directory during build.
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
Add the stylesheet to your layout's `<head>`:
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
```scss
|
|
56
|
-
@import "github-code";
|
|
53
|
+
```html
|
|
54
|
+
<link rel="stylesheet" href="/assets/github-code/css/github-code.css">
|
|
57
55
|
```
|
|
58
56
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
Add the contents of `assets/js/github-code.js` to your site's JavaScript, or include it directly:
|
|
57
|
+
Add the JavaScript before the closing `</body>` tag (required for the copy button):
|
|
62
58
|
|
|
63
59
|
```html
|
|
64
|
-
<script src="/assets/js/github-code.js"></script>
|
|
60
|
+
<script src="/assets/github-code/js/github-code.js"></script>
|
|
65
61
|
```
|
|
66
62
|
|
|
63
|
+
#### For Chirpy Theme
|
|
64
|
+
|
|
65
|
+
If you're using the Chirpy theme, you can alternatively:
|
|
66
|
+
|
|
67
|
+
1. Copy the CSS content to your custom styles
|
|
68
|
+
2. Or add the link tag to `_includes/head.html`
|
|
69
|
+
3. Add the script tag to `_layouts/default.html` before `</body>`
|
|
70
|
+
|
|
67
71
|
## Usage
|
|
68
72
|
|
|
69
73
|
### Basic Usage - Full File
|
|
@@ -171,16 +171,12 @@
|
|
|
171
171
|
padding: 16px;
|
|
172
172
|
margin: 16px 0;
|
|
173
173
|
font-size: 14px;
|
|
174
|
+
color: var(--github-code-error-border);
|
|
174
175
|
}
|
|
175
176
|
|
|
176
177
|
.github-code-error strong {
|
|
177
178
|
display: block;
|
|
178
179
|
margin-bottom: 4px;
|
|
179
|
-
color: var(--github-code-error-border);
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
.github-code-error {
|
|
183
|
-
color: var(--github-code-error-border);
|
|
184
180
|
}
|
|
185
181
|
|
|
186
182
|
/* Light theme error state */
|
|
@@ -379,3 +375,4 @@
|
|
|
379
375
|
font-size: 12px;
|
|
380
376
|
}
|
|
381
377
|
}
|
|
378
|
+
|
data/assets/js/github-code.js
CHANGED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Jekyll
|
|
4
|
+
module GitHubCode
|
|
5
|
+
# Generator that copies the CSS and JS assets to the site
|
|
6
|
+
class Generator < Jekyll::Generator
|
|
7
|
+
safe true
|
|
8
|
+
priority :lowest
|
|
9
|
+
|
|
10
|
+
def generate(site)
|
|
11
|
+
# Find the gem's root directory (where assets/ is located)
|
|
12
|
+
gem_root = File.expand_path('../../..', __dir__)
|
|
13
|
+
assets_source = File.join(gem_root, 'assets')
|
|
14
|
+
|
|
15
|
+
# Copy CSS file
|
|
16
|
+
css_source = File.join(assets_source, 'css', 'github-code.css')
|
|
17
|
+
if File.exist?(css_source)
|
|
18
|
+
site.static_files << AssetFile.new(
|
|
19
|
+
site,
|
|
20
|
+
assets_source,
|
|
21
|
+
'css',
|
|
22
|
+
'github-code.css'
|
|
23
|
+
)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# Copy JS file
|
|
27
|
+
js_source = File.join(assets_source, 'js', 'github-code.js')
|
|
28
|
+
if File.exist?(js_source)
|
|
29
|
+
site.static_files << AssetFile.new(
|
|
30
|
+
site,
|
|
31
|
+
assets_source,
|
|
32
|
+
'js',
|
|
33
|
+
'github-code.js'
|
|
34
|
+
)
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Custom static file class for gem assets
|
|
40
|
+
class AssetFile < Jekyll::StaticFile
|
|
41
|
+
def initialize(site, base, dir, name)
|
|
42
|
+
@site = site
|
|
43
|
+
@base = base
|
|
44
|
+
@dir = dir
|
|
45
|
+
@name = name
|
|
46
|
+
@relative_path = File.join(dir, name)
|
|
47
|
+
@extname = File.extname(name)
|
|
48
|
+
@collection = nil
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def path
|
|
52
|
+
File.join(@base, @dir, @name)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def destination(dest)
|
|
56
|
+
File.join(dest, 'assets', 'github-code', @dir, @name)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def write(dest)
|
|
60
|
+
dest_path = destination(dest)
|
|
61
|
+
return false unless File.exist?(path)
|
|
62
|
+
|
|
63
|
+
FileUtils.mkdir_p(File.dirname(dest_path))
|
|
64
|
+
FileUtils.cp(path, dest_path)
|
|
65
|
+
true
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def modified?
|
|
69
|
+
true
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
data/lib/jekyll-github-code.rb
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require 'jekyll'
|
|
4
|
+
|
|
3
5
|
require_relative 'jekyll-github-code/version'
|
|
4
6
|
require_relative 'jekyll-github-code/github_reference'
|
|
5
7
|
require_relative 'jekyll-github-code/code_fetcher'
|
|
6
8
|
require_relative 'jekyll-github-code/code_renderer'
|
|
7
9
|
require_relative 'jekyll-github-code/tag'
|
|
10
|
+
require_relative 'jekyll-github-code/generator'
|
|
8
11
|
|
|
9
12
|
module Jekyll
|
|
10
13
|
module GitHubCode
|
metadata
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: jekyll-github-code
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Rodolfo Olivieri
|
|
8
|
+
autorequire:
|
|
8
9
|
bindir: bin
|
|
9
10
|
cert_chain: []
|
|
10
|
-
date:
|
|
11
|
+
date: 2025-12-12 00:00:00.000000000 Z
|
|
11
12
|
dependencies:
|
|
12
13
|
- !ruby/object:Gem::Dependency
|
|
13
14
|
name: jekyll
|
|
@@ -114,13 +115,14 @@ files:
|
|
|
114
115
|
- LICENSE
|
|
115
116
|
- README.md
|
|
116
117
|
- Rakefile
|
|
117
|
-
- assets/css/github-code.
|
|
118
|
+
- assets/css/github-code.css
|
|
118
119
|
- assets/js/github-code.js
|
|
119
120
|
- demo.html
|
|
120
121
|
- jekyll-github-code.gemspec
|
|
121
122
|
- lib/jekyll-github-code.rb
|
|
122
123
|
- lib/jekyll-github-code/code_fetcher.rb
|
|
123
124
|
- lib/jekyll-github-code/code_renderer.rb
|
|
125
|
+
- lib/jekyll-github-code/generator.rb
|
|
124
126
|
- lib/jekyll-github-code/github_reference.rb
|
|
125
127
|
- lib/jekyll-github-code/tag.rb
|
|
126
128
|
- lib/jekyll-github-code/version.rb
|
|
@@ -134,6 +136,7 @@ metadata:
|
|
|
134
136
|
homepage_uri: https://github.com/r0x0d/jekyll-github-code
|
|
135
137
|
source_code_uri: https://github.com/r0x0d/jekyll-github-code
|
|
136
138
|
rubygems_mfa_required: 'true'
|
|
139
|
+
post_install_message:
|
|
137
140
|
rdoc_options: []
|
|
138
141
|
require_paths:
|
|
139
142
|
- lib
|
|
@@ -148,7 +151,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
148
151
|
- !ruby/object:Gem::Version
|
|
149
152
|
version: '0'
|
|
150
153
|
requirements: []
|
|
151
|
-
rubygems_version: 3.
|
|
154
|
+
rubygems_version: 3.4.19
|
|
155
|
+
signing_key:
|
|
152
156
|
specification_version: 4
|
|
153
157
|
summary: A Jekyll plugin to embed code from GitHub repositories
|
|
154
158
|
test_files: []
|