jekyll-theme-cheatsheet 0.0.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 880860da700aefbe00f99f33fc4d7bd1bf6c017974a48ff1d6c99ac372110985
4
+ data.tar.gz: aa40013d2744e825d05ccc894ef458996426d2ae5d56931723cd63f0b2c102e4
5
+ SHA512:
6
+ metadata.gz: 4376b282baea4cd49f5c849304a03f620b60bb76b37084dbd2bbe6ebfcf2129c9918e766fe8e48bf35c07c221a1e7275e3a3564255c1c1497085e4098db88a2c
7
+ data.tar.gz: ca35ee94b815a6dcc4b0e0abc1370f6a84a453c61f50dea37b882d95c9a571cb0ca9c779061f95aa53e383d9111b744a4a74034900a9641c7703caf91508534b
data/README.md ADDED
@@ -0,0 +1,48 @@
1
+ # jekyll-theme-cheatsheet
2
+
3
+ Welcome to your new Jekyll theme! In this directory, you'll find the files you need to be able to package up your theme into a gem. Put your layouts in `_layouts`, your includes in `_includes`, your sass files in `_sass` and any other assets in `assets`.
4
+
5
+ To experiment with this code, add some sample content and run `bundle exec jekyll serve` – this directory is setup just like a Jekyll site!
6
+
7
+ ## Installation
8
+
9
+ Add this line to your Jekyll site's `Gemfile`:
10
+
11
+ ```ruby
12
+ gem "jekyll-theme-cheatsheet"
13
+ ```
14
+
15
+ And add this line to your Jekyll site's `_config.yml`:
16
+
17
+ ```yaml
18
+ theme: jekyll-theme-cheatsheet
19
+ ```
20
+
21
+ And then execute:
22
+
23
+ $ bundle
24
+
25
+ Or install it yourself as:
26
+
27
+ $ gem install jekyll-theme-cheatsheet
28
+
29
+ ## Usage
30
+
31
+ TODO: Write usage instructions here. Describe your available layouts, includes, sass and/or assets.
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/jekyll-theme-cheatsheet. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](https://www.contributor-covenant.org/) code of conduct.
36
+
37
+ ## Development
38
+
39
+ To set up your environment to develop this theme, run `bundle install`.
40
+
41
+ Your theme is setup just like a normal Jekyll site! To test your theme, run `bundle exec jekyll serve` and open your browser at `http://localhost:4000`. This starts a Jekyll server using your theme. Add pages, documents, data, etc. like normal to test your theme's contents. As you make modifications to your theme and to your content, your site will regenerate and you should see the changes in the browser after a refresh, just like normal.
42
+
43
+ When your theme is released, only the files in `_layouts`, `_includes`, `_sass` and `assets` tracked with Git will be bundled.
44
+ To add a custom directory to your theme-gem, please edit the regexp in `jekyll-theme-cheatsheet.gemspec` accordingly.
45
+
46
+ ## License
47
+
48
+ The theme is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/_config.yml ADDED
@@ -0,0 +1,12 @@
1
+ name: My Cheatsheet
2
+ url: https://localhost:4000
3
+ lang: en
4
+ # footer:
5
+ # - contact:
6
+ # url: https://github.com/j7k6
7
+ # display: GitHub
8
+ base: /
9
+ permalink: /:title/
10
+ encoding: utf-8
11
+ sass:
12
+ style: compressed
data/_includes/main.js ADDED
@@ -0,0 +1,69 @@
1
+ 'use strict';
2
+
3
+ const inputElement = document.querySelector('header.index h1 a');
4
+ const allItems = [...document.querySelectorAll('ul.index li')];
5
+
6
+ const siteTitle = inputElement.textContent;
7
+
8
+ if (inputElement != null) {
9
+ let q = '';
10
+ let timeout;
11
+
12
+ document.addEventListener('keydown', function(e) {
13
+ if (e.keyCode === 32) {
14
+ e.preventDefault();
15
+ }
16
+ });
17
+
18
+ document.addEventListener('keyup', function(e) {
19
+ if (e.keyCode === 27) {
20
+ q = '';
21
+ } else if (e.keyCode === 8 || e.keyCode === 46 || e.keyCode === 32 || String.fromCharCode(e.keyCode).match(/[0-9a-z]/i)) {
22
+ if (e.keyCode === 8 || e.keyCode === 46) {
23
+ q = q.slice(0, -1);
24
+ } else {
25
+ q += e.key;
26
+ }
27
+
28
+ inputElement.innerHTML = q;
29
+
30
+ let qc = q.replace(/[.*+?^${}()|[\]\\]/g, '\\$&').replace(/(\s\s+|\s)/g, ' ').replace(/\\/, '');
31
+
32
+ if (qc.length === 1) {
33
+ allItems.forEach(el => el.style.display='block');
34
+ }
35
+
36
+ if (qc.length > 1) {
37
+ clearTimeout(timeout);
38
+
39
+ timeout = setTimeout(function() {
40
+ allItems.forEach(el => el.style.display='none');
41
+
42
+ let queryWords = q.split(' ').map(word => `(?=.*${word}.*)`).join('');
43
+ let matchItems = allItems.filter(el => el.querySelector('a').innerText.match(new RegExp(`^(${queryWords}.+)`, 'i')));
44
+
45
+ if (matchItems.length === 0) {
46
+ document.querySelector('div.nores').style.display = 'block';
47
+ } else {
48
+ document.querySelector('div.nores').style.display = 'none';
49
+ }
50
+
51
+ matchItems.forEach(el => el.style.display='block');
52
+ matchItems.forEach(el => el.querySelector('a').innerHTML = el.querySelector('a').innerText.replace(new RegExp(q.split(' ').join('|'), 'gi'), match => `<strong>${match}</strong>`));
53
+ }, 100);
54
+ }
55
+ }
56
+
57
+ if (q.length === 0) {
58
+ [...document.querySelectorAll('ul.index li a strong')].forEach(el => el.replaceWith(...el.childNodes));
59
+
60
+ allItems.forEach(el => el.style.display='none');
61
+ allItems.filter(el => el.classList.contains('fav')).forEach(el => el.style.display='block');
62
+
63
+ inputElement.innerHTML = siteTitle;
64
+ }
65
+ });
66
+ }
67
+
68
+ // variable highlighter
69
+ [...document.querySelectorAll('article code')].forEach(el => el.innerHTML = el.innerText.replace(/<([^$].*)>/gi, '&lt;$1&gt;').replace(/<\$([A-Z0-9_]+)>/g, match => `<span class="var">${match}</span>`));
@@ -0,0 +1,366 @@
1
+ @-webkit-keyframes blinker {
2
+ from {opacity: 1.0;}
3
+ to {opacity: 0.0;}
4
+ }
5
+
6
+ @keyframes blinker {
7
+ from {opacity: 1.0;}
8
+ to {opacity: 0.0;}
9
+ }
10
+
11
+ $color1: #444;
12
+ $color2: #666;
13
+ $color3: #b8b8b8;
14
+ $color4: #f8f8f8;
15
+
16
+ $defaultFont: -apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, helvetica, Ubuntu, roboto, noto, arial, sans-serif;
17
+ $codeFont: Menlo, Consolas, Monaco, Liberation Mono, Lucida Console, monospace;
18
+
19
+ html {
20
+ overflow: auto;
21
+ overflow-x: hidden;
22
+ }
23
+
24
+ html, body {
25
+ width: 100%;
26
+ height: 100%;
27
+ margin: 0;
28
+ padding: 0;
29
+ }
30
+
31
+ body {
32
+ font-family: $defaultFont;
33
+ color: $color1;
34
+ line-height: 1.75;
35
+ text-rendering: optimizeLegibility;
36
+ -webkit-font-smoothing: antialiased;
37
+ -moz-osx-font-smoothing: grayscale;
38
+ }
39
+
40
+ * {
41
+ margin: 0;
42
+ padding: 0;
43
+
44
+ &:focus {
45
+ outline: none;
46
+ }
47
+ }
48
+
49
+ ul, ol {
50
+ li {
51
+ & > ul, & > ol {
52
+ margin: 0 0 0 1.5rem;
53
+ }
54
+ }
55
+ }
56
+
57
+ ul.index {
58
+ margin: 1rem auto 2rem auto;
59
+ list-style-type: none;
60
+
61
+ li {
62
+ display: none;
63
+ overflow: hidden;
64
+
65
+ &.fav {
66
+ display: block;
67
+
68
+ a:before {
69
+ content: attr(data-date) '\00a0\002a\00a0' !important;
70
+ }
71
+ }
72
+
73
+ a {
74
+ display: block;
75
+ line-height: 2.5;
76
+ text-overflow: ellipsis;
77
+ white-space: nowrap;
78
+ overflow: hidden;
79
+
80
+ &:before {
81
+ font-style: normal;
82
+ font-size: 80%;
83
+ font-weight: 400 !important;
84
+ content: attr(data-date) '\00a0\00a0\00a0';
85
+ font-family: $codeFont;
86
+ display: inline-block;
87
+ color: $color1;
88
+ }
89
+ }
90
+ }
91
+ }
92
+
93
+ article {
94
+ overflow-x: hidden;
95
+ margin: 1rem auto;
96
+
97
+ & > * {
98
+ display: block;
99
+ margin: 0 auto 1rem auto;
100
+ }
101
+
102
+ div.date {
103
+ font-size: 80%;
104
+ font-family: $codeFont;
105
+ font-weight: normal;
106
+ margin: 1rem 0 0 0;
107
+ }
108
+
109
+ ul, ol {
110
+ margin-left: 2rem;
111
+
112
+ li {
113
+ margin: 1rem 0;
114
+
115
+ & > * {
116
+ margin-top: 1rem;
117
+ }
118
+ }
119
+ }
120
+
121
+ h1 {
122
+ margin-bottom: 1rem;
123
+
124
+ & + hr {
125
+ margin: 0 0 3rem 0 !important;
126
+ width: 10%;
127
+ }
128
+ }
129
+
130
+ hr {
131
+ margin: 2rem 0 1rem 0;
132
+ height: 0;
133
+ border: none;
134
+ border-top: 1px solid $color3;
135
+
136
+ &:last-of-type {
137
+ width: 10%;
138
+ margin-top: 3rem;
139
+
140
+ & + ol {
141
+ font-size: 90%;
142
+ margin: 0 0 1rem 0 !important;
143
+ color: $color3;
144
+ counter-reset: o-counter 0;
145
+
146
+ li {
147
+ margin: 0;
148
+ line-height: 1.25;
149
+ display: block;
150
+ overflow: hidden;
151
+ text-overflow: ellipsis;
152
+ white-space: nowrap;
153
+
154
+ &:before {
155
+ color: $color3;
156
+ content: '[' counter(o-counter) '] ';
157
+ counter-increment: o-counter;
158
+ font-family: $codeFont;
159
+ font-size: 80%;
160
+ }
161
+ }
162
+ }
163
+ }
164
+ }
165
+
166
+ img {
167
+ max-width: 90% !important;
168
+ display: block;
169
+ margin: 1rem auto;
170
+ }
171
+
172
+ pre, code, blockquote {
173
+ border-radius: 3px;
174
+ background: $color4;
175
+ color: $color2;
176
+ }
177
+
178
+ pre, blockquote {
179
+ overflow: auto;
180
+ padding: .5rem 1rem;
181
+ }
182
+
183
+ blockquote {
184
+ font-style: italic;
185
+ border-left: 3px solid $color3;
186
+ display: flex;
187
+ align-items: center;
188
+
189
+ &:before {
190
+ content: '!';
191
+ color: $color3;
192
+ font-size: 250%;
193
+ font-weight: bold;
194
+ font-style: normal;
195
+ font-family: $codeFont;
196
+ margin-right: 1rem;
197
+ line-height: 1;
198
+ }
199
+ }
200
+
201
+ code {
202
+ font-size: 90%;
203
+ font-family: $codeFont;
204
+ padding: 3px;
205
+ }
206
+
207
+ pre {
208
+ scrollbar-width: none;
209
+
210
+ & > code {
211
+ padding: 0;
212
+ }
213
+
214
+ &::-webkit-scrollbar {
215
+ display: none;
216
+ }
217
+ }
218
+ }
219
+
220
+ h1, h2, h3, h4, h5 {
221
+ line-height: 1.3;
222
+ margin: 3rem 0 1.38rem;
223
+
224
+ a {
225
+ color: inherit;
226
+ }
227
+ }
228
+
229
+ h1 + h2, h2 + h3, h3 + h4, h4 + h5 {
230
+ margin-top: 0;
231
+ }
232
+
233
+ h1 {
234
+ margin: 0 0 2rem 0;
235
+ font-size: 1.802rem;
236
+
237
+ a {
238
+ color: inherit;
239
+
240
+ &:hover {
241
+ text-decoration: none;
242
+ }
243
+ }
244
+
245
+ }
246
+
247
+ h2 {font-size: 1.602rem;}
248
+ h3 {font-size: 1.424rem;}
249
+ h4 {font-size: 1.266rem;}
250
+ h5 {font-size: 1.125rem;}
251
+
252
+ @-webkit-keyframes blinker {
253
+ from {opacity: 1.0;}
254
+ to {opacity: 0.0;}
255
+ }
256
+ @keyframes blinker {
257
+ from {opacity: 1.0;}
258
+ to {opacity: 0.0;}
259
+ }
260
+
261
+ header {
262
+ font-family: $codeFont;
263
+ margin: 2rem auto 0 auto;
264
+
265
+ h1 {
266
+ margin: 0 0 2rem 0;
267
+ font-size: 1.2rem;
268
+ font-weight: normal;
269
+
270
+ a {
271
+ color: inherit;
272
+ padding-bottom: .25rem;
273
+ border-bottom: 1px solid $color1;
274
+ }
275
+ }
276
+
277
+ &.index h1 {
278
+ font-size: 1.602rem;
279
+
280
+ &:after {
281
+ content: '\00a0';
282
+ text-decoration: blink;
283
+ animation: blinker 0.7s infinite ease-in-out alternate;
284
+ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAYAAABytg0kAAAAFUlEQVR4AWMwMTH5717gw8AAJMAcAC3GBT28lH6HAAAAAElFTkSuQmCC);
285
+ margin-left: .25rem;
286
+ }
287
+ }
288
+ }
289
+
290
+ footer {
291
+ margin: 1rem auto;
292
+ padding-bottom: 2rem;
293
+ color: $color3;
294
+ font-size: 90%;
295
+
296
+ a {
297
+ color: inherit;
298
+ }
299
+
300
+ ul {
301
+ list-style-type: none;
302
+
303
+ li {
304
+ display: inline-block;
305
+
306
+ &:not(:first-child):before {
307
+ content: '\00B7';
308
+ padding: 0 .5rem;
309
+ }
310
+ }
311
+ }
312
+ }
313
+
314
+ table {
315
+ tr {
316
+ th {
317
+ font-weight: bold;
318
+ text-align: left;
319
+ padding: .5em;
320
+ }
321
+
322
+ td {
323
+ padding: .5em;
324
+ }
325
+ }
326
+ }
327
+
328
+ .wrapper {
329
+ width: 600px;
330
+ max-width: 90vw;
331
+ margin: 2rem auto;
332
+ padding-bottom: 2rem;
333
+ }
334
+
335
+ a {
336
+ text-decoration: none;
337
+
338
+ &:hover {
339
+ text-decoration: underline;
340
+ }
341
+ }
342
+
343
+ span.var {
344
+ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAYAAABytg0kAAAAFUlEQVR4AWMwMTH5717gw8AAJMAcAC3GBT28lH6HAAAAAElFTkSuQmCC);
345
+ color: $color4;
346
+ border-radius: 2px;
347
+ padding: 0 2px;
348
+ }
349
+
350
+ div.nores {
351
+ display: none;
352
+ }
353
+
354
+ @media (pointer: coarse) {
355
+ header.index h1 {
356
+ font-size: 1.5em;
357
+
358
+ &:after {
359
+ display: none;
360
+ }
361
+ }
362
+
363
+ ul.index li {
364
+ display: block !important;
365
+ }
366
+ }
@@ -0,0 +1,53 @@
1
+ <!doctype html>
2
+ <html lang="{{ site.lang }}">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta http-equiv="x-ua-compatible" content="ie=edge">
6
+ <title>{% if page.title %}{{ page.title }}{% else %}{{ site.name }}{% endif %}</title>
7
+ <meta name="viewport" content="width=device-width, initial-scale=1">
8
+ {% capture styles %}
9
+ {% include main.scss %}
10
+ {% endcapture %}
11
+ <style>{{ styles | scssify }}</style>
12
+ <link rel="alternate" type="application/rss+xml" title="{{ site.name }}" href="/feed.xml" >
13
+ </head>
14
+
15
+ <body>
16
+ <div class="wrapper">
17
+ <header{% if page.url == '/' %} class="index"{% endif %}>
18
+ <h1{% if page.url != '/' %} class="small"{% endif %}><a href="/">{{ site.name }}</a></h1>
19
+ </header>
20
+
21
+ <div class="content">
22
+ {{ content }}
23
+ </div>
24
+
25
+ {% assign now = 'now' | date: '%Y' %}
26
+
27
+ {% if site.posts.size > 0 %}
28
+ {% assign posts = site.posts | sort: 'date' %}
29
+ {% assign start_year = posts[0].date | date: "%Y" %}
30
+ {% else %}
31
+ {% assign start_year = now %}
32
+ {% endif %}
33
+
34
+ {% if start_year == now %}
35
+ {% assign copyright_date = start_year %}
36
+ {% else %}
37
+ {% assign copyright_date = '–' | prepend: start_year | append: now %}
38
+ {% endif %}
39
+
40
+ <footer>
41
+ <ul>
42
+ <li>{{ copyright_date }}</li><!--
43
+ --><li><a href="/feed.xml">RSS</a></li><!--
44
+ -->{% for item in site.footer %}{% if item.url != nil and item.display != nil %}<li><a href="{{ item.url }}">{{ item.display }}</a></li>{% endif %}{% endfor %}
45
+ </ul>
46
+ </footer>
47
+ </div>
48
+
49
+ <script type="application/javascript">
50
+ {% include main.js %}
51
+ </script>
52
+ </body>
53
+ </html>
@@ -0,0 +1,11 @@
1
+ ---
2
+ layout: default
3
+ ---
4
+
5
+ {% assign post = page %}
6
+ <article class="post">
7
+ <div class="date">{{ page.date | date_to_string }}</div>
8
+ <h1><a href="{{ post.id }}/">{{ post.title }}</a></h1>
9
+ <hr>
10
+ {{ content }}
11
+ </article>
metadata ADDED
@@ -0,0 +1,62 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jekyll-theme-cheatsheet
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - j7k6
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2025-04-25 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: jekyll
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '4.3'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '4.3'
27
+ description:
28
+ email:
29
+ - mail@j7k6.org
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - README.md
35
+ - _config.yml
36
+ - _includes/main.js
37
+ - _includes/main.scss
38
+ - _layouts/default.html
39
+ - _layouts/post.html
40
+ homepage: https://github.com/j7k6
41
+ licenses: []
42
+ metadata: {}
43
+ post_install_message:
44
+ rdoc_options: []
45
+ require_paths:
46
+ - lib
47
+ required_ruby_version: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ version: '0'
52
+ required_rubygems_version: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ requirements: []
58
+ rubygems_version: 3.2.3
59
+ signing_key:
60
+ specification_version: 4
61
+ summary: minimal
62
+ test_files: []