pandoc-markdown-jekyll-theme 0.17.0 → 0.18.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ba2ae9b2976f1e8212a1fe746b206537c187dc18215f5995fd69fa3ac0e20648
4
- data.tar.gz: 2d53c489bb87c067e02455475484c88db41b9bc9718fc0eb571324e20f05be2b
3
+ metadata.gz: 28fe564cdc5cca4dd6beb87d3b9fffdcde844bfcbdc85387c90073175f7fed03
4
+ data.tar.gz: 3d2cb0e2c945e7476563ffa9807abd5a7fc794d6e1e1b5e7bb5997ffea9d0a74
5
5
  SHA512:
6
- metadata.gz: 2cc6b3a6bd3abfea6efcda3803792a5abf962c7764cd898fa60fe1af310049916ba8930586f6f2d6069d1db6621d8bb5b2774f20e4050c585ff0169b86e1fd24
7
- data.tar.gz: e66a08121a5b4a7a8f8379cda04e316b2c014f01db7c88d0d40ce2ee3624b2b9a809205e719f8f66dd0b1e6f7f5c47e738a5360c270798334250546f6c1f8745
6
+ metadata.gz: e93ad6edda47e9d731684af8e11f8a18e5b0d856b536cb9bc0145c20fcd7569afa5d2f5445ee1b1d991e7358ed0d06f35823c3884c81bc07dca268c838ac7684
7
+ data.tar.gz: 5699a081795c049031dfaef74b0cfdc30062b5133d0a8cde6f946ee67d015c90e69c4b2dcf4218ca46a270a29c63b622c1f448549901e8e08216088b997ceaa7
data/README.md CHANGED
@@ -17,7 +17,10 @@ installation is as easy as:
17
17
 
18
18
  ```bash
19
19
  brew install pandoc
20
- brew install jez/formulae/pandoc-sidenote
20
+
21
+ curl --remote-name --no-clobber --create-dirs \
22
+ --output-dir "${XDG_DATA_DIR:-$HOME/.local/share/}/pandoc/filters" \
23
+ -sSL "https://github.com/jez/pandoc-sidenote/raw/refs/heads/master/pandoc-sidenote.lua"
21
24
  ```
22
25
 
23
26
  Next, add this line to your Jekyll site's Gemfile:
@@ -55,7 +58,7 @@ markdown: Pandoc
55
58
  pandoc:
56
59
  extensions:
57
60
  - from: 'markdown+smart+tex_math_single_backslash'
58
- - filter: 'pandoc-sidenote'
61
+ - lua-filter: 'pandoc-sidenote.lua'
59
62
  - template: '_template'
60
63
  - katex
61
64
  - toc
@@ -109,9 +112,10 @@ The following variables are used by this theme.
109
112
  - `page.dir`
110
113
  - Sets the HTML dir attribute. Default: `'ltr'`
111
114
 
112
- You can also define:
115
+ You can also define either of:
113
116
 
114
117
  - `_includes/enable_checkboxes.html`
118
+ - `_includes/block_based_side_notes.html`
115
119
 
116
120
  to be an empty file in your project to remove the only non-math JavaScript.
117
121
 
@@ -0,0 +1 @@
1
+ <script src="{{ site.baseurl }}/assets/js/block_based_side_notes.js"></script>
@@ -11,6 +11,7 @@
11
11
 
12
12
  {% include footer.html %}
13
13
  {% include enable_checkboxes.html %}
14
+ {% include block_based_side_notes.html %}
14
15
  {% include after.html %}
15
16
  </body>
16
17
  </html>
data/assets/css/theme.css CHANGED
@@ -206,22 +206,36 @@ body {
206
206
  margin-top: var(--side-note-baseline-offset);
207
207
  }
208
208
 
209
+ :is(.sidenote, .marginnote) figcaption {
210
+ font-size: var(--side-note-font-size);
211
+ line-height: var(--side-note-line-height);
212
+ }
213
+
209
214
  .sidenote code,
210
215
  .marginnote code {
211
216
  color: var(--color-sidenote);
212
217
  }
213
218
 
219
+ /* Make paragraph breaks within sidenotes smaller. */
220
+ main > .sidenote-wrapper > :is(.marginnote, .sidenote) {
221
+ margin-bottom: var(--side-note-line-height);
222
+ }
223
+
214
224
  main {
215
- counter-reset: sidenote-counter;
225
+ counter-reset: sidenote-counter-anchor sidenote-counter;
216
226
  }
217
227
 
218
- .sidenote-number {
219
- counter-increment: sidenote-counter;
228
+ .sidenote-number:after {
229
+ counter-increment: sidenote-counter-anchor;
230
+ content: counter(sidenote-counter-anchor);
220
231
  }
221
232
 
222
- .sidenote-number:after,
223
233
  .sidenote:before {
234
+ counter-increment: sidenote-counter;
224
235
  content: counter(sidenote-counter);
236
+ }
237
+ .sidenote-number:after,
238
+ .sidenote:before {
225
239
  position: relative;
226
240
  }
227
241
 
@@ -248,10 +262,11 @@ sup {
248
262
  font-weight: inherit;
249
263
  }
250
264
 
251
- /* Make the superscript hang. */
252
- .sidenote:before { left: var(--side-note-number-hang-left); }
253
- /* Get first first column of first row to line up with other rows. */
254
- .sidenote { text-indent: var(--side-note-text-indent); }
265
+ /* Make the superscript hang in the margin. */
266
+ .sidenote:before {
267
+ position: absolute;
268
+ right: calc(100% + 0.5ch);
269
+ }
255
270
 
256
271
  /*}}} */
257
272
  /* --- Side note input controls --- {{{ */
@@ -345,18 +360,60 @@ h3 {
345
360
  font-weight: bold;
346
361
  }
347
362
 
348
- h1:not(.title) + *, h1:not(.title) + p { margin-top: var(--h1-margin-bottom); }
349
- h2 + *, h2 + p { margin-top: var(--h2-margin-bottom); }
350
- h3 + *, h3 + p { margin-top: 0; }
363
+ /* No one should ever have more than 4 sidenotes immediately after a heading */
364
+ /* 0 */ h1:not(.title) + :is(*:not(.sidenote-wrapper), p),
365
+ /* 1 */ h1:not(.title) + .sidenote-wrapper + :is(*:not(.sidenote-wrapper), p),
366
+ /* 2 */ h1:not(.title) + .sidenote-wrapper + .sidenote-wrapper + :is(*:not(.sidenote-wrapper), p),
367
+ /* 3 */ h1:not(.title) + .sidenote-wrapper + .sidenote-wrapper + .sidenote-wrapper + :is(*:not(.sidenote-wrapper), p),
368
+ /* 4 */ h1:not(.title) + .sidenote-wrapper + .sidenote-wrapper + .sidenote-wrapper + .sidenote-wrapper + :is(*:not(.sidenote-wrapper), p) {
369
+ margin-top: var(--h1-margin-bottom);
370
+ }
371
+ /* 0 */ h2 + :is(*:not(.sidenote-wrapper), p),
372
+ /* 1 */ h2 + .sidenote-wrapper + :is(*:not(.sidenote-wrapper), p),
373
+ /* 2 */ h2 + .sidenote-wrapper + .sidenote-wrapper + :is(*:not(.sidenote-wrapper), p),
374
+ /* 3 */ h2 + .sidenote-wrapper + .sidenote-wrapper + .sidenote-wrapper + :is(*:not(.sidenote-wrapper), p),
375
+ /* 4 */ h2 + .sidenote-wrapper + .sidenote-wrapper + .sidenote-wrapper + .sidenote-wrapper + :is(*:not(.sidenote-wrapper), p) {
376
+ margin-top: var(--h2-margin-bottom);
377
+ }
378
+ /* 0 */ h3 + :is(*:not(.sidenote-wrapper), p),
379
+ /* 1 */ h3 + .sidenote-wrapper + :is(*:not(.sidenote-wrapper), p),
380
+ /* 2 */ h3 + .sidenote-wrapper + .sidenote-wrapper + :is(*:not(.sidenote-wrapper), p),
381
+ /* 3 */ h3 + .sidenote-wrapper + .sidenote-wrapper + .sidenote-wrapper + :is(*:not(.sidenote-wrapper), p),
382
+ /* 4 */ h3 + .sidenote-wrapper + .sidenote-wrapper + .sidenote-wrapper + .sidenote-wrapper + :is(*:not(.sidenote-wrapper), p) {
383
+ margin-top: 0;
384
+ }
351
385
 
352
386
  /* }}} */
353
387
  /* ----- Prose --------------------------------------------------------- {{{ */
354
388
 
355
- p, main > ul, main > ol, div.sourceCode, main > pre, img, table {
389
+ p, main > ul, main > ol, .wide, :not(.wide) > div.sourceCode, main > pre, img, table, blockquote {
356
390
  margin-top: var(--line-height);
357
391
  margin-bottom: var(--line-height)
358
392
  }
359
393
 
394
+ :is(.marginnote, .sidenote) :is(p, main > ul, main > ol, .wide, :not(.wide) > div.sourceCode, main > pre, img, table, blockquote) {
395
+ margin-top: var(--side-note-font-size);
396
+ margin-bottom: var(--side-note-font-size);
397
+ }
398
+
399
+ /* Block-style sidenotes will have `p` tags in them, but we need to not have extra margins. */
400
+ .sidenote-wrapper > :is(.marginnote, .sidenote) > :is(p, main > ul, main > ol, .wide, :not(.wide) > div.sourceCode, main > pre, img, table, blockquote):first-child {
401
+ margin-top: 0;
402
+ }
403
+ .sidenote-wrapper > :is(.marginnote, .sidenote) > :is(p, main > ul, main > ol, .wide, :not(.wide) > div.sourceCode, main > pre, img, table, blockquote):last-child {
404
+ margin-bottom: 0;
405
+ }
406
+
407
+ .wide > p:first-child,
408
+ .wide > table:first-child,
409
+ :is(p, figure) > img:first-child {
410
+ margin-top: 0;
411
+ }
412
+ .wide > p:last-child,
413
+ :is(p, figure) > img:last-child {
414
+ margin-bottom: 0;
415
+ }
416
+
360
417
  ul:not(.task-list) {
361
418
  margin-left: var(--ul-indent-size);
362
419
  }
@@ -786,7 +843,10 @@ figure + p {
786
843
  margin-top: var(--captioned-figure-gap);
787
844
  }
788
845
 
789
- figure > img, figure > pre, figure > div.sourceCode {
846
+ figure > img, figure > pre, figure > div.sourceCode, figure:not(.wide) > div.sourceCode {
847
+ margin-bottom: var(--figcaption-gap);
848
+ }
849
+ :is(.sidenote, .marginnote) :is(figure > img, figure > pre, figure > div.sourceCode, figure:not(.wide) > div.sourceCode) {
790
850
  margin-bottom: var(--figcaption-gap);
791
851
  }
792
852
 
@@ -1184,6 +1244,11 @@ nav#TOC > input:checked + ul {
1184
1244
 
1185
1245
  .wide {
1186
1246
  width: var(--main-width);
1247
+ }
1248
+ .sidenote-wrapper .wide {
1249
+ width: 100%;
1250
+ }
1251
+ .wide {
1187
1252
  overflow-x: auto;
1188
1253
  overflow-y: hidden;
1189
1254
  }
@@ -1220,10 +1285,20 @@ nav#TOC > input:checked + ul {
1220
1285
  margin-right: var(--line-height);
1221
1286
  }
1222
1287
 
1223
- .sidenote,
1224
- .marginnote {
1288
+ .margin-toggle:not(:checked) + .marginnote {
1225
1289
  display: none;
1226
1290
  }
1291
+ .margin-toggle:not(:checked) + .sidenote {
1292
+ /* .sidenote is special because .sidenote:before tracks the counter,
1293
+ * and counters don't increment for display: none;
1294
+ * https://stackoverflow.com/a/36600119
1295
+ * */
1296
+ position: absolute;
1297
+ left: -9999px;
1298
+ max-height: 0px;
1299
+ overflow: hidden;
1300
+ opacity: 0;
1301
+ }
1227
1302
 
1228
1303
  .margin-toggle:checked + .sidenote,
1229
1304
  .margin-toggle:checked + .marginnote {
@@ -0,0 +1,46 @@
1
+ ;(function() {
2
+ function hoistAbove() {
3
+ const toHoist = document.querySelectorAll('main > .sidenote-wrapper + :not(.sidenote-wrapper)');
4
+ for (let i = toHoist.length - 1; i >= 0; i--) {
5
+ const source = toHoist[i];
6
+ let target = source.previousElementSibling;
7
+ while (target.previousElementSibling.classList.contains('sidenote-wrapper')) {
8
+ target = target.previousElementSibling;
9
+ }
10
+ source.parentNode.insertBefore(source, target);
11
+ }
12
+ }
13
+
14
+ function sinkBelow() {
15
+ const toHoist = document.querySelectorAll('main > :not(.sidenote-wrapper) + .sidenote-wrapper');
16
+ for (let i = 0; i < toHoist.length; i++) {
17
+ const source = toHoist[i].previousElementSibling;
18
+ let target = source.nextElementSibling;
19
+ while (target.classList.contains('sidenote-wrapper')) {
20
+ target = target.nextElementSibling;
21
+ }
22
+ source.parentNode.insertBefore(source, target);
23
+ }
24
+ }
25
+
26
+ if (window.matchMedia('screen')) {
27
+ if (window.innerWidth <= 796) {
28
+ hoistAbove();
29
+ }
30
+ let prevSize = window.innerWidth;
31
+ // Needs to mirror breakpoints in :root settings in CSS variables
32
+ // 745px = --main-width-narrow
33
+ // 26px = --line-height
34
+ // 169px = side note min width narrow
35
+ const breakpoint = 26 + 550 + 26 + 169 + 26 - 1;
36
+ window.addEventListener('resize', function() {
37
+ const newSize = window.innerWidth;
38
+ if (prevSize >= breakpoint && newSize < breakpoint) {
39
+ hoistAbove();
40
+ } else if (prevSize < breakpoint && newSize >= breakpoint) {
41
+ sinkBelow();
42
+ }
43
+ prevSize = newSize;
44
+ });
45
+ }
46
+ })();
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pandoc-markdown-jekyll-theme
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.0
4
+ version: 0.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jake Zimmerman
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-11-03 00:00:00.000000000 Z
11
+ date: 2026-01-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll-pandoc
@@ -66,7 +66,7 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '10.0'
69
- description:
69
+ description:
70
70
  email:
71
71
  - zimmerman.jake@gmail.com
72
72
  executables: []
@@ -76,6 +76,7 @@ files:
76
76
  - README.md
77
77
  - _includes/after.html
78
78
  - _includes/before.html
79
+ - _includes/block_based_side_notes.html
79
80
  - _includes/default.html
80
81
  - _includes/enable_checkboxes.html
81
82
  - _includes/footer.html
@@ -88,6 +89,7 @@ files:
88
89
  - _template.html5
89
90
  - assets/css/skylighting-solarized-theme.css
90
91
  - assets/css/theme.css
92
+ - assets/js/block_based_side_notes.js
91
93
  - assets/js/enable_checkboxes.js
92
94
  - assets/js/enable_katex.js
93
95
  - assets/libs/KaTeX/0.11.1/fonts/KaTeX_AMS-Regular.ttf
@@ -156,7 +158,7 @@ homepage: https://github.com/jez/pandoc-markdown-jekyll-theme
156
158
  licenses:
157
159
  - BlueOak-1.0.0
158
160
  metadata: {}
159
- post_install_message:
161
+ post_install_message:
160
162
  rdoc_options: []
161
163
  require_paths:
162
164
  - lib
@@ -171,8 +173,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
171
173
  - !ruby/object:Gem::Version
172
174
  version: '0'
173
175
  requirements: []
174
- rubygems_version: 3.0.3.1
175
- signing_key:
176
+ rubygems_version: 3.1.2
177
+ signing_key:
176
178
  specification_version: 4
177
179
  summary: A Jekyll theme based on jez/pandoc-markdown-css-theme
178
180
  test_files: []