jekyll-github-code 0.1.0 → 0.2.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cf7c2830265d7dc0c56dd352412820a1cae0df5289030dc0825da1a9f9c9b5d8
4
- data.tar.gz: a14cad52d57785d3b77ff1393dafe6b5ef790d7b48a6cbe01dab65d2a69f24cf
3
+ metadata.gz: 58cb8f106a3bc26d54137cc0078176180d8ccd3541e4eab79430ee771425a24d
4
+ data.tar.gz: c3f3eae22c927f640b58de9d107d1505a49f0c9adcbb63b36f4b3167cb581600
5
5
  SHA512:
6
- metadata.gz: 3803d1ad25166a79ddc769b4fc1f1b2f3d0a9bcdd851dfb5b7f4bab677a96214d2e98614ef0f1d95e2569e0da2b75030e18cfb6ba10e134ec81eefd1395eed7a
7
- data.tar.gz: a99f5ca6f838459883c5ecc0bb96ef4ac98fb7885daf9b81981d128dfce9c635ceffe77c6c3b49d84d99ff9de6665887bb768b17f8e4f0551b141e7955afbcde
6
+ metadata.gz: ac9cea954fea7d62470ef2528c77717b1b384863099f366840e62ff8bd8ad9268fb7eddaa86df3bbbfe439f198b91d2f336cae4afd0eb2672803f914584b7bed
7
+ data.tar.gz: 93b7ab57f0ba8d0397c313ebdfa186c1088a106ffe856701293009643f3dd023e6b38786bc9312f74ece3f12632ca9815ce7975c5f3dc7777c6e1a4ee4c82f78
data/CHANGELOG.md CHANGED
@@ -5,6 +5,16 @@ 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.1] - 2025-12-12
9
+
10
+ ### Fixed
11
+ - Location for automatic asset generation (css and js copied to `_site/assets/github-code/`)
12
+
13
+ ## [0.2.0] - 2025-12-12
14
+
15
+ ### Added
16
+ - Automatic asset generation (css and js copied to `_site/assets/github-code/`)
17
+
8
18
  ## [0.1.0] - 2025-12-12
9
19
 
10
20
  ### Added
@@ -17,7 +27,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
17
27
  - Automatic language detection based on file extension
18
28
  - Copy-to-clipboard button
19
29
  - Clickable filename linking to GitHub
20
- - Dark and light theme support
30
+ - Dark and light theme support (multiple theme systems supported)
21
31
  - Compatible with Jekyll Chirpy theme
22
32
  - Comprehensive test suite
23
-
data/README.md CHANGED
@@ -44,26 +44,30 @@ plugins:
44
44
  - jekyll-github-code
45
45
  ```
46
46
 
47
- ### Add the Styles
47
+ ### Include the Assets
48
48
 
49
- Copy the SCSS file to your `_sass` directory or add these styles to your main stylesheet.
49
+ The plugin automatically copies CSS and JS files to your site's `_site/assets/github-code/` directory during build.
50
50
 
51
- You can find the styles in `assets/css/github-code.scss` in this repository.
51
+ Add the stylesheet to your layout's `<head>`:
52
52
 
53
- For Chirpy theme, add to `assets/css/jekyll-theme-chirpy.scss`:
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
- ### Add the JavaScript (optional, for copy button)
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
+
@@ -27,4 +27,3 @@ function copyGitHubCode(button) {
27
27
  console.error('Failed to copy code:', err);
28
28
  });
29
29
  }
30
-
@@ -0,0 +1,81 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Jekyll
4
+ module GithubCard
5
+ class StyleGenerator < Jekyll::Generator
6
+ safe true
7
+ priority :low
8
+
9
+ def generate(site)
10
+ content = File.read(File.join(File.dirname(__FILE__), "..", "..", "assets", "css", "github-code.css"))
11
+
12
+ # Create a static file for the CSS
13
+ site.static_files << StyleFile.new(site, content)
14
+ end
15
+ end
16
+
17
+ class JavaScriptGenerator < Jekyll::Generator
18
+ safe true
19
+ priority :low
20
+
21
+ def generate(site)
22
+ content = File.read(File.join(File.dirname(__FILE__), "..", "..", "assets", "js", "github-code.js"))
23
+
24
+ # Create a static file for the CSS
25
+ site.static_files << JavaScriptFile.new(site, content)
26
+ end
27
+ end
28
+
29
+ class StyleFile < Jekyll::StaticFile
30
+ def initialize(site, content)
31
+ @site = site
32
+ @content = content
33
+ @relative_path = "/assets/css/github-code.css"
34
+ @extname = ".css"
35
+ @name = "github-code.css"
36
+ @dir = "/assets/css"
37
+ end
38
+
39
+ def write(dest)
40
+ dest_path = File.join(dest, @relative_path)
41
+ FileUtils.mkdir_p(File.dirname(dest_path))
42
+ File.write(dest_path, @content)
43
+ true
44
+ end
45
+
46
+ def path
47
+ @relative_path
48
+ end
49
+
50
+ def relative_path
51
+ @relative_path
52
+ end
53
+ end
54
+
55
+ class JavaScriptFile < Jekyll::StaticFile
56
+ def initialize(site, content)
57
+ @site = site
58
+ @content = content
59
+ @relative_path = "/assets/js/github-code.js"
60
+ @extname = ".js"
61
+ @name = "github-code.js"
62
+ @dir = "/assets/js"
63
+ end
64
+
65
+ def write(dest)
66
+ dest_path = File.join(dest, @relative_path)
67
+ FileUtils.mkdir_p(File.dirname(dest_path))
68
+ File.write(dest_path, @content)
69
+ true
70
+ end
71
+
72
+ def path
73
+ @relative_path
74
+ end
75
+
76
+ def relative_path
77
+ @relative_path
78
+ end
79
+ end
80
+ end
81
+ end
@@ -2,7 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  module GitHubCode
5
- VERSION = '0.1.0'
5
+ VERSION = '0.2.1'
6
6
  end
7
7
  end
8
-
@@ -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.1.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rodolfo Olivieri
8
+ autorequire:
8
9
  bindir: bin
9
10
  cert_chain: []
10
- date: 1980-01-02 00:00:00.000000000 Z
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.scss
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.6.9
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: []