pandoc-markdown-jekyll-theme 0.16.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: 98baa39b8f49cae59e4e11b367641634a33c84c7d1d90861d76020957270ad1a
4
- data.tar.gz: 85660e4a5eb2f9d6393e7ac71ee2f6d0613ee41e67501d8f53d09626ff8fb56a
3
+ metadata.gz: 28fe564cdc5cca4dd6beb87d3b9fffdcde844bfcbdc85387c90073175f7fed03
4
+ data.tar.gz: 3d2cb0e2c945e7476563ffa9807abd5a7fc794d6e1e1b5e7bb5997ffea9d0a74
5
5
  SHA512:
6
- metadata.gz: c7dd503985f7ea7e230cd87aa068dcbe87c25967683761b1485a3c5cddb4725e1b19e81308f580f6bd6475a4a77dd0668f9f40c431c58408b1c895699079ebb0
7
- data.tar.gz: 7457f7e18541d5872ba6d99b35df43d7d155fb8bf125e8f373fbf02123d284c40cdaff0a19e1bc761a5514b2c7e2978f0d729b14ec4b41105501e363ea4456d8
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
  }
@@ -528,11 +585,6 @@ pre > code {
528
585
  padding: 0 var(--code-block-side-padding);
529
586
  }
530
587
 
531
- code.sourceCode::selection {
532
- /* Prevent bug where far right edge of text box shows as selected. */
533
- background: transparent;
534
- }
535
-
536
588
  .wide > pre, .wide > div.sourceCode {
537
589
  /* Put this in front of the table of contents */
538
590
  transform: translateZ(0px);
@@ -550,7 +602,7 @@ pre > code.sourceCode > span {
550
602
  line-height: var(--line-height);
551
603
 
552
604
  display: inline-block;
553
- min-width: 100%;
605
+ position: relative;
554
606
  }
555
607
 
556
608
  div.sourceCode {
@@ -568,8 +620,7 @@ pre.numberSource > code.sourceCode > span {
568
620
  counter-increment: source-line;
569
621
  padding-left: var(--line-numbers-width);
570
622
  text-indent: var(--line-numbers-negative-width);
571
- position: relative;
572
- left: var(--line-numbers-negative-width);
623
+ margin-left: var(--line-numbers-negative-width);
573
624
  }
574
625
  pre.numberSource > code.sourceCode > span > a:first-child::before {
575
626
  -webkit-touch-callout: none;
@@ -626,12 +677,16 @@ pre > code.sourceCode > span::after {
626
677
  position: absolute;
627
678
  background-color: var(--color-code-highlight-bg);
628
679
  z-index: -1;
629
- left: calc(var(--line-numbers-width) - var(--code-block-side-padding));
630
- right: calc(var(--line-numbers-negative-width) - var(--code-block-side-padding));
680
+ left: calc(-1 * var(--code-block-side-padding));
681
+ right: calc(-1 * var(--code-block-side-padding));
631
682
  top: 0;
632
683
  height: 100%;
633
684
  }
634
685
 
686
+ pre.numberSource > code.sourceCode > span::after {
687
+ left: calc(var(--line-numbers-width) - var(--code-block-side-padding));
688
+ }
689
+
635
690
  pre.hl-1 > code.sourceCode > span:nth-of-type(1)::after { content: ""; }
636
691
  pre.hl-2 > code.sourceCode > span:nth-of-type(2)::after { content: ""; }
637
692
  pre.hl-3 > code.sourceCode > span:nth-of-type(3)::after { content: ""; }
@@ -673,6 +728,107 @@ pre.hl-38 > code.sourceCode > span:nth-of-type(38)::after { content: ""; }
673
728
  pre.hl-39 > code.sourceCode > span:nth-of-type(39)::after { content: ""; }
674
729
  pre.hl-40 > code.sourceCode > span:nth-of-type(40)::after { content: ""; }
675
730
 
731
+ /**
732
+ * The span needs to be at least as big as the enclosing code block, or else
733
+ * the ::after highlight will not be wide enough.
734
+ *
735
+ * Ideally, we would set this on all spans, regardless of whether it's got a
736
+ * highlight or not. But in Chrome, setting a min-width on an inline-block
737
+ * element makes Chrome think that the newline character is at the very end of
738
+ * the element. It's like Chrome puts empty space bewteen the last character of
739
+ * the line and the newline to get it up to the min-width, instead of putting
740
+ * that extra space after the newline.
741
+ *
742
+ * This is normally invisible, unless you're selecting text to copy it, in
743
+ * which case it's jarring to see Chrome selecting a newline character off in
744
+ * space. We want to minimize that so that it happens as little as possible.
745
+ * Namely, selecting code that does not have a background `.hl-*` will not show
746
+ * a weird floating newline.
747
+ *
748
+ * This seems to only affect Chrome, because only Chrome shows the newline as a
749
+ * part of the selection.
750
+ */
751
+ pre.hl-1 > code.sourceCode > span:nth-of-type(1) { min-width: 100%; }
752
+ pre.hl-2 > code.sourceCode > span:nth-of-type(2) { min-width: 100%; }
753
+ pre.hl-3 > code.sourceCode > span:nth-of-type(3) { min-width: 100%; }
754
+ pre.hl-4 > code.sourceCode > span:nth-of-type(4) { min-width: 100%; }
755
+ pre.hl-5 > code.sourceCode > span:nth-of-type(5) { min-width: 100%; }
756
+ pre.hl-6 > code.sourceCode > span:nth-of-type(6) { min-width: 100%; }
757
+ pre.hl-7 > code.sourceCode > span:nth-of-type(7) { min-width: 100%; }
758
+ pre.hl-8 > code.sourceCode > span:nth-of-type(8) { min-width: 100%; }
759
+ pre.hl-9 > code.sourceCode > span:nth-of-type(9) { min-width: 100%; }
760
+ pre.hl-10 > code.sourceCode > span:nth-of-type(10) { min-width: 100%; }
761
+ pre.hl-11 > code.sourceCode > span:nth-of-type(11) { min-width: 100%; }
762
+ pre.hl-12 > code.sourceCode > span:nth-of-type(12) { min-width: 100%; }
763
+ pre.hl-13 > code.sourceCode > span:nth-of-type(13) { min-width: 100%; }
764
+ pre.hl-14 > code.sourceCode > span:nth-of-type(14) { min-width: 100%; }
765
+ pre.hl-15 > code.sourceCode > span:nth-of-type(15) { min-width: 100%; }
766
+ pre.hl-16 > code.sourceCode > span:nth-of-type(16) { min-width: 100%; }
767
+ pre.hl-17 > code.sourceCode > span:nth-of-type(17) { min-width: 100%; }
768
+ pre.hl-18 > code.sourceCode > span:nth-of-type(18) { min-width: 100%; }
769
+ pre.hl-19 > code.sourceCode > span:nth-of-type(19) { min-width: 100%; }
770
+ pre.hl-20 > code.sourceCode > span:nth-of-type(20) { min-width: 100%; }
771
+ pre.hl-21 > code.sourceCode > span:nth-of-type(21) { min-width: 100%; }
772
+ pre.hl-22 > code.sourceCode > span:nth-of-type(22) { min-width: 100%; }
773
+ pre.hl-23 > code.sourceCode > span:nth-of-type(23) { min-width: 100%; }
774
+ pre.hl-24 > code.sourceCode > span:nth-of-type(24) { min-width: 100%; }
775
+ pre.hl-25 > code.sourceCode > span:nth-of-type(25) { min-width: 100%; }
776
+ pre.hl-26 > code.sourceCode > span:nth-of-type(26) { min-width: 100%; }
777
+ pre.hl-27 > code.sourceCode > span:nth-of-type(27) { min-width: 100%; }
778
+ pre.hl-28 > code.sourceCode > span:nth-of-type(28) { min-width: 100%; }
779
+ pre.hl-29 > code.sourceCode > span:nth-of-type(29) { min-width: 100%; }
780
+ pre.hl-30 > code.sourceCode > span:nth-of-type(30) { min-width: 100%; }
781
+ pre.hl-31 > code.sourceCode > span:nth-of-type(31) { min-width: 100%; }
782
+ pre.hl-32 > code.sourceCode > span:nth-of-type(32) { min-width: 100%; }
783
+ pre.hl-33 > code.sourceCode > span:nth-of-type(33) { min-width: 100%; }
784
+ pre.hl-34 > code.sourceCode > span:nth-of-type(34) { min-width: 100%; }
785
+ pre.hl-35 > code.sourceCode > span:nth-of-type(35) { min-width: 100%; }
786
+ pre.hl-36 > code.sourceCode > span:nth-of-type(36) { min-width: 100%; }
787
+ pre.hl-37 > code.sourceCode > span:nth-of-type(37) { min-width: 100%; }
788
+ pre.hl-38 > code.sourceCode > span:nth-of-type(38) { min-width: 100%; }
789
+ pre.hl-39 > code.sourceCode > span:nth-of-type(39) { min-width: 100%; }
790
+ pre.hl-40 > code.sourceCode > span:nth-of-type(40) { min-width: 100%; }
791
+ pre.numberSource.hl-1 > code.sourceCode > span:nth-of-type(1) { min-width: calc(100% + var(--line-numbers-width)); }
792
+ pre.numberSource.hl-2 > code.sourceCode > span:nth-of-type(2) { min-width: calc(100% + var(--line-numbers-width)); }
793
+ pre.numberSource.hl-3 > code.sourceCode > span:nth-of-type(3) { min-width: calc(100% + var(--line-numbers-width)); }
794
+ pre.numberSource.hl-4 > code.sourceCode > span:nth-of-type(4) { min-width: calc(100% + var(--line-numbers-width)); }
795
+ pre.numberSource.hl-5 > code.sourceCode > span:nth-of-type(5) { min-width: calc(100% + var(--line-numbers-width)); }
796
+ pre.numberSource.hl-6 > code.sourceCode > span:nth-of-type(6) { min-width: calc(100% + var(--line-numbers-width)); }
797
+ pre.numberSource.hl-7 > code.sourceCode > span:nth-of-type(7) { min-width: calc(100% + var(--line-numbers-width)); }
798
+ pre.numberSource.hl-8 > code.sourceCode > span:nth-of-type(8) { min-width: calc(100% + var(--line-numbers-width)); }
799
+ pre.numberSource.hl-9 > code.sourceCode > span:nth-of-type(9) { min-width: calc(100% + var(--line-numbers-width)); }
800
+ pre.numberSource.hl-10 > code.sourceCode > span:nth-of-type(10) { min-width: calc(100% + var(--line-numbers-width)); }
801
+ pre.numberSource.hl-11 > code.sourceCode > span:nth-of-type(11) { min-width: calc(100% + var(--line-numbers-width)); }
802
+ pre.numberSource.hl-12 > code.sourceCode > span:nth-of-type(12) { min-width: calc(100% + var(--line-numbers-width)); }
803
+ pre.numberSource.hl-13 > code.sourceCode > span:nth-of-type(13) { min-width: calc(100% + var(--line-numbers-width)); }
804
+ pre.numberSource.hl-14 > code.sourceCode > span:nth-of-type(14) { min-width: calc(100% + var(--line-numbers-width)); }
805
+ pre.numberSource.hl-15 > code.sourceCode > span:nth-of-type(15) { min-width: calc(100% + var(--line-numbers-width)); }
806
+ pre.numberSource.hl-16 > code.sourceCode > span:nth-of-type(16) { min-width: calc(100% + var(--line-numbers-width)); }
807
+ pre.numberSource.hl-17 > code.sourceCode > span:nth-of-type(17) { min-width: calc(100% + var(--line-numbers-width)); }
808
+ pre.numberSource.hl-18 > code.sourceCode > span:nth-of-type(18) { min-width: calc(100% + var(--line-numbers-width)); }
809
+ pre.numberSource.hl-19 > code.sourceCode > span:nth-of-type(19) { min-width: calc(100% + var(--line-numbers-width)); }
810
+ pre.numberSource.hl-20 > code.sourceCode > span:nth-of-type(20) { min-width: calc(100% + var(--line-numbers-width)); }
811
+ pre.numberSource.hl-21 > code.sourceCode > span:nth-of-type(21) { min-width: calc(100% + var(--line-numbers-width)); }
812
+ pre.numberSource.hl-22 > code.sourceCode > span:nth-of-type(22) { min-width: calc(100% + var(--line-numbers-width)); }
813
+ pre.numberSource.hl-23 > code.sourceCode > span:nth-of-type(23) { min-width: calc(100% + var(--line-numbers-width)); }
814
+ pre.numberSource.hl-24 > code.sourceCode > span:nth-of-type(24) { min-width: calc(100% + var(--line-numbers-width)); }
815
+ pre.numberSource.hl-25 > code.sourceCode > span:nth-of-type(25) { min-width: calc(100% + var(--line-numbers-width)); }
816
+ pre.numberSource.hl-26 > code.sourceCode > span:nth-of-type(26) { min-width: calc(100% + var(--line-numbers-width)); }
817
+ pre.numberSource.hl-27 > code.sourceCode > span:nth-of-type(27) { min-width: calc(100% + var(--line-numbers-width)); }
818
+ pre.numberSource.hl-28 > code.sourceCode > span:nth-of-type(28) { min-width: calc(100% + var(--line-numbers-width)); }
819
+ pre.numberSource.hl-29 > code.sourceCode > span:nth-of-type(29) { min-width: calc(100% + var(--line-numbers-width)); }
820
+ pre.numberSource.hl-30 > code.sourceCode > span:nth-of-type(30) { min-width: calc(100% + var(--line-numbers-width)); }
821
+ pre.numberSource.hl-31 > code.sourceCode > span:nth-of-type(31) { min-width: calc(100% + var(--line-numbers-width)); }
822
+ pre.numberSource.hl-32 > code.sourceCode > span:nth-of-type(32) { min-width: calc(100% + var(--line-numbers-width)); }
823
+ pre.numberSource.hl-33 > code.sourceCode > span:nth-of-type(33) { min-width: calc(100% + var(--line-numbers-width)); }
824
+ pre.numberSource.hl-34 > code.sourceCode > span:nth-of-type(34) { min-width: calc(100% + var(--line-numbers-width)); }
825
+ pre.numberSource.hl-35 > code.sourceCode > span:nth-of-type(35) { min-width: calc(100% + var(--line-numbers-width)); }
826
+ pre.numberSource.hl-36 > code.sourceCode > span:nth-of-type(36) { min-width: calc(100% + var(--line-numbers-width)); }
827
+ pre.numberSource.hl-37 > code.sourceCode > span:nth-of-type(37) { min-width: calc(100% + var(--line-numbers-width)); }
828
+ pre.numberSource.hl-38 > code.sourceCode > span:nth-of-type(38) { min-width: calc(100% + var(--line-numbers-width)); }
829
+ pre.numberSource.hl-39 > code.sourceCode > span:nth-of-type(39) { min-width: calc(100% + var(--line-numbers-width)); }
830
+ pre.numberSource.hl-40 > code.sourceCode > span:nth-of-type(40) { min-width: calc(100% + var(--line-numbers-width)); }
831
+
676
832
  /* }}} */
677
833
 
678
834
  /* }}} */
@@ -687,7 +843,10 @@ figure + p {
687
843
  margin-top: var(--captioned-figure-gap);
688
844
  }
689
845
 
690
- 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) {
691
850
  margin-bottom: var(--figcaption-gap);
692
851
  }
693
852
 
@@ -1085,6 +1244,11 @@ nav#TOC > input:checked + ul {
1085
1244
 
1086
1245
  .wide {
1087
1246
  width: var(--main-width);
1247
+ }
1248
+ .sidenote-wrapper .wide {
1249
+ width: 100%;
1250
+ }
1251
+ .wide {
1088
1252
  overflow-x: auto;
1089
1253
  overflow-y: hidden;
1090
1254
  }
@@ -1121,10 +1285,20 @@ nav#TOC > input:checked + ul {
1121
1285
  margin-right: var(--line-height);
1122
1286
  }
1123
1287
 
1124
- .sidenote,
1125
- .marginnote {
1288
+ .margin-toggle:not(:checked) + .marginnote {
1126
1289
  display: none;
1127
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
+ }
1128
1302
 
1129
1303
  .margin-toggle:checked + .sidenote,
1130
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.16.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-09-01 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: []