jekyll-chatgpt 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/lib/chatgpt.sass +65 -64
- data/lib/jekyll-chatgpt/version.rb +1 -1
- data/lib/jekyll-chatgpt.rb +30 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 681dec7900a693bd5210549c18140bf1d993059effb4ad8bfdf474995479bafb
|
4
|
+
data.tar.gz: e84ff1e7a0c1a5d40f62660b3a4a6188d6c47d269db3f3c94a9b92b1d68e0942
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 454e7a3ea814cf55314315c8ccf750e7cc54eb3ef6f04b315025683e32d27079a41b9fa7df7b2f158c611716791f2927f645c88929f940945826d4ea0dc1c164
|
7
|
+
data.tar.gz: 608139a4c8b3874c7d2f59b86905a2c97fafda1b602d2e62f645bf256016cd08d4c8f573d9509ba8894b4e88291a0ec50754ebdb48e94c500f4a933865ac53f9
|
data/README.md
CHANGED
@@ -32,6 +32,10 @@ Optionally, include a stylesheet for code syntax highlighting in ChatGPT output.
|
|
32
32
|
|
33
33
|
The necessary styles will automatically be inlined when using the filter. You can override the default colors by providing the following variables in your `_sass/_colors.sass` file : `$color1`, `$color1-alt`, `$color2`, `$color2-alt`, `$cyan`
|
34
34
|
|
35
|
+
### Customizing the SASS/CSS
|
36
|
+
|
37
|
+
You can put your custom SASS inside `_sass/_chatgpt_custom.sass`. If the file exists, it will be imported and the properties set in your custom stylesheet will take precedence by using [CSS layers](https://developer.mozilla.org/en-US/docs/Web/CSS/@layer). The demo uses this to add rounded borders to the controls.
|
38
|
+
|
35
39
|
### Live demo
|
36
40
|
|
37
41
|
You can browse the [code for the live demo](https://github.com/pcouy/jekyll-chatgpt/tree/demo) which is intended to be a minimal example of using the plugin.
|
data/lib/chatgpt.sass
CHANGED
@@ -4,72 +4,73 @@ $color2: #cc3 !default
|
|
4
4
|
$color2-alt: #c3c !default
|
5
5
|
$cyan: #2aa198 !default
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
7
|
+
@layer chatgpt-default
|
8
|
+
.chatgpt-conversation
|
9
|
+
$tab-border: $color1-alt
|
10
|
+
position: relative
|
11
|
+
height: 400px
|
12
|
+
overflow-y: scroll
|
13
|
+
border: 1px solid $tab-border
|
14
|
+
margin: 2em 0.5em
|
14
15
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
16
|
+
.chatgpt-message
|
17
|
+
display: none
|
18
|
+
position: absolute
|
19
|
+
left: 0
|
20
|
+
width: 100%
|
21
|
+
top: 1.5em
|
22
|
+
&:target
|
23
|
+
border: 1px solid $color1
|
24
|
+
border-radius: 5px
|
25
|
+
width: 98%
|
26
|
+
margin: 0.75%
|
27
|
+
.chatgpt-control:checked ~ .chatgpt-message
|
28
|
+
display: block
|
29
|
+
&>.chatgpt-messagebody
|
30
|
+
margin-bottom: 0.5em
|
31
|
+
&>pre
|
32
|
+
display: inline
|
33
|
+
word-wrap: normal
|
34
|
+
white-space: pre-wrap
|
35
|
+
&>p
|
36
|
+
margin-block-start: 0.25em
|
37
|
+
margin-top: 0.25em
|
38
|
+
&>.chatgpt-message
|
39
|
+
display: block
|
40
|
+
top: 3em
|
40
41
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
42
|
+
.chatgpt-role-user::before
|
43
|
+
content: "User : "
|
44
|
+
color: $color2-alt
|
45
|
+
/*border: 1px solid $color1-alt
|
46
|
+
.chatgpt-role-assistant::before
|
47
|
+
content: "ChatGPT : "
|
48
|
+
color: $color2
|
49
|
+
/*border: 1px solid $color2
|
49
50
|
|
50
|
-
|
51
|
-
position: relative
|
52
|
-
.chatgpt-control
|
53
|
-
position: absolute
|
54
|
-
left: -300vw
|
55
|
-
&:only-child
|
56
|
-
& > label
|
57
|
-
display: none
|
58
|
-
& > .chatgpt-message
|
59
|
-
top: 0
|
60
|
-
& > label
|
51
|
+
.chatgpt-messagechild
|
61
52
|
position: relative
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
53
|
+
.chatgpt-control
|
54
|
+
position: absolute
|
55
|
+
left: -300vw
|
56
|
+
&:only-child
|
57
|
+
& > label
|
58
|
+
display: none
|
59
|
+
& > .chatgpt-message
|
60
|
+
top: 0
|
61
|
+
& > label
|
62
|
+
position: relative
|
63
|
+
display: block
|
64
|
+
float: left
|
65
|
+
padding-right: 0.2em
|
66
|
+
padding-left: 0.2em
|
67
|
+
margin-top: 0.1em
|
68
|
+
&:first-child
|
69
|
+
margin-left: 0.3em
|
70
|
+
border-bottom: 1px solid $tab-border
|
71
|
+
.chatgpt-messagechild:first-child > label
|
68
72
|
margin-left: 0.3em
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
color: $cyan
|
74
|
-
border: 1px solid $tab-border
|
75
|
-
border-bottom: none
|
73
|
+
.chatgpt-control:checked + label
|
74
|
+
color: $cyan
|
75
|
+
border: 1px solid $tab-border
|
76
|
+
border-bottom: none
|
data/lib/jekyll-chatgpt.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
require_relative "jekyll-chatgpt/version"
|
4
4
|
require "liquid"
|
5
5
|
require "jekyll"
|
6
|
+
require "jekyll/converters/scss"
|
6
7
|
|
7
8
|
module JekyllChatgpt
|
8
9
|
class Error < StandardError; end
|
@@ -55,22 +56,44 @@ module JekyllChatgpt
|
|
55
56
|
# Renders needed styles and JS
|
56
57
|
class StyleGenerator < Jekyll::Generator
|
57
58
|
safe true
|
58
|
-
priority :
|
59
|
+
priority :highest
|
60
|
+
|
61
|
+
def sass_converter(site)
|
62
|
+
@sass_converter ||= Jekyll::Converters::Sass.new(site.config)
|
63
|
+
end
|
64
|
+
|
65
|
+
def sass_exists(site, file)
|
66
|
+
sass_converter(site).sass_load_paths.each do |dir|
|
67
|
+
return true unless Dir.new(dir).children.index(file).nil?
|
68
|
+
end
|
69
|
+
false
|
70
|
+
end
|
71
|
+
|
72
|
+
def colors_exists?(site)
|
73
|
+
sass_exists(site, "_colors.sass")
|
74
|
+
end
|
75
|
+
|
76
|
+
def style_exists?(site)
|
77
|
+
sass_exists(site, "_chatgpt_custom.sass")
|
78
|
+
end
|
79
|
+
|
80
|
+
def add_js(site)
|
81
|
+
message_label_js = Jekyll::StaticFile.new(site, __dir__, "", "chatgpt_message_label.js")
|
82
|
+
site.static_files << message_label_js
|
83
|
+
end
|
59
84
|
|
60
85
|
def generate(site)
|
61
86
|
chatgpt_style = Jekyll::PageWithoutAFile.new(site, __dir__, "", "chatgpt.sass")
|
62
87
|
chatgpt_style.tap do |file|
|
63
|
-
colors_exists = site.pages.filter do |page|
|
64
|
-
page.name =~ /colors\.sass$/i
|
65
|
-
end.size
|
66
88
|
file.content = ""
|
67
|
-
file.content += "@import \"colors\"\n" if colors_exists
|
89
|
+
file.content += "@import \"colors\"\n\n" if colors_exists?(site)
|
90
|
+
file.content += "@layer chatgpt-default, chatgpt-custom\n\n"
|
91
|
+
file.content += "@layer chatgpt-custom\n @import \"chatgpt_custom\"\n\n" if style_exists?(site)
|
68
92
|
file.content += File.read(File.expand_path("chatgpt.sass", __dir__))
|
69
93
|
end
|
70
94
|
site.pages << chatgpt_style
|
71
95
|
|
72
|
-
|
73
|
-
site.static_files << message_label_js
|
96
|
+
add_js(site)
|
74
97
|
end
|
75
98
|
end
|
76
99
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-chatgpt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- pcouy
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-04-
|
11
|
+
date: 2023-04-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|