hematite 0.1.5 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d695f60bf686920b70204b57a6938283468f63be8ba35467bff6db792fbed6af
4
- data.tar.gz: d5b505891fb8bb9be670d61454b8c80e5c0ac7463d22fbeba4244ceea9692a78
3
+ metadata.gz: 35584fa03a622c59a4b30f481935571355857bd0095c31f9884d97f26b41ba0d
4
+ data.tar.gz: dd0e32bd5dfdc7041898a6e2d6eec06854ec1d772756ff447a0ae71fe576595e
5
5
  SHA512:
6
- metadata.gz: 1f67a7e799a1a0bf26222a9fb9891e8265bf70d1f2e5210cdc85d0e293499c6da68ed589c401ab754ff30588d81eb8a3923a104b2343569539f01d95f0f80d39
7
- data.tar.gz: e8c5c1dcde0d2f9087a251658e5a7e5eb15dd97f2a8ac31bdeb2147fad6fac8f609d42a96d85bb36964c6f43511baa0cc5202cdd3335a11dadb8fb2729d5e398
6
+ metadata.gz: 6fd8ce2ca17d3826b982a2e289d6d1e9386245258e5263d587edf53ef90efc3c9c765587ebf5d1a45435d37469c56c43a6f6039eac591767ba5ebb5a9e0d29c6
7
+ data.tar.gz: 736c44dbaaddbb632f377b214f8b4dc5a43b872198b64dcb06fad06d8b0b573a6e0b3a2d443c9840b6ce9cfc82ba6c7e7ae3a780bff747cdff2262999563fbbe
@@ -8,4 +8,40 @@
8
8
 
9
9
  <!-- Page/site-specific imports and configuration -->
10
10
  {{ site.additional_import_html | default: "" }}
11
+ {{ layout.additional_import_html | default: "" }}
11
12
  {{ page.additional_import_html | default: "" }}
13
+
14
+ {% comment %}
15
+ Each [spec]=["key", { property: value, property2: value2, ... }]
16
+ {% endcomment %}
17
+ {% for spec in layout.additional_imports | concat: page.additional_imports %}
18
+ {% assign target = spec[1] %}
19
+ {% if target.type == 'js' or target.type == 'mjs' %}
20
+ {% assign tag="script" %}
21
+ {% assign url_spec = "src" %}
22
+ {% assign options = "" %}
23
+ {% else %}
24
+ {% assign tag="link" %}
25
+ {% assign options = "rel='stylesheet'" %}
26
+ {% assign url_spec = "href" %}
27
+ {% endif %}
28
+
29
+ {% if target.type == 'mjs' %}
30
+ {% assign options = "type = 'module'" %}
31
+ {% endif %}
32
+
33
+ {% if target.absolute_url %}
34
+ {% assign url = target.absolute_url %}
35
+ {% else %}
36
+ {% assign url = target.url | relative_url %}
37
+ {% endif %}
38
+
39
+ {% if target.context and target.context != include.context %}
40
+ {% else %}
41
+ <{{ tag }} {{ options }}
42
+ {{ target.inline_options | default: "" }}
43
+ {{url_spec}}={{ url | jsonify }}
44
+ onload={{ target.onload | default: "" | jsonify }}></{{tag}}>
45
+ {% endif %}
46
+ {% endfor %}
47
+
@@ -4,7 +4,7 @@
4
4
  KaTeX can be enabled with page.katex.
5
5
  -->
6
6
 
7
- {% if page.katex || site.mermaid %}
7
+ {% if page.katex or layout.katex or site.mermaid %}
8
8
 
9
9
  <!-- See the releases tab on https://github.com/KaTeX/KaTeX -->
10
10
  <link
@@ -2,7 +2,7 @@
2
2
  <!--
3
3
  Include mermaid-js scripts.
4
4
  -->
5
- {% if page.mermaid || site.mermaid %}
5
+ {% if page.mermaid or site.mermaid or layout.mermaid %}
6
6
  <script>
7
7
  var MERMAID_CONFIG = window.MERMAID_CONFIG ?? {{ site.mermaid_config | jsonify }} ?? { };
8
8
 
@@ -0,0 +1,47 @@
1
+ ---
2
+ layout: remark_slideshow
3
+ additional_imports:
4
+ katex:
5
+ type: js
6
+ url: /assets/plugin/katex/katex.min.js
7
+ context: remark_frame
8
+ comment: >-
9
+ Setting context to remark_frame means to only run this
10
+ in the remark-specific iframe.
11
+ katex_auto_init_math:
12
+ type: js
13
+ url: /assets/plugin/katex/contrib/auto-render.min.js
14
+ onload: renderMathInElement(document.body)
15
+ inline_options: defer
16
+ comment: >-
17
+ We're passing 'defer' above because we want this script to load
18
+ _after_ the body.
19
+ katex_css:
20
+ type: css
21
+ url: /assets/plugin/katex/katex.min.css
22
+
23
+ remark_presentation_config:
24
+ navigation:
25
+ scroll: false
26
+ slideNumberFormat: "Slide %current% of %total%."
27
+
28
+ mermaid: true
29
+ remark_presentation_config_html: >-
30
+ Testing... This should be included at the top of the file.
31
+ ---
32
+
33
+ {% comment %}
34
+ This template is an example of how to customize remark slideshows
35
+ by creating a new template.
36
+
37
+ `additional_imports` can be used on any page. In this case, the imports
38
+ are included both in the remark presentation `iframe` and in the main page.
39
+
40
+ Of course, we could include `katex` or `mermaid` here by setting `katex: true`
41
+ or `mermaid: true` in the header`, but `additional_imports` is another way to
42
+ specify this.
43
+
44
+ Note that `remark_presentation_config` is passed directly to remark.
45
+ {% endcomment %}
46
+
47
+ {{ content }}
@@ -32,7 +32,7 @@ layout: default
32
32
  <script defer type="module">
33
33
  // Matches <div>...</div> or <div markdown=0>...</div>
34
34
  // Jekyll can remove the 'markdown=0' while parsing.
35
- const WRAPPING_DIV_EXP = /\s*[<]div.*[>]((?:.|[\n\r])*)[<]\/div[>]\s*/;
35
+ const WRAPPING_DIV_EXP = /^\s*[<]div.*[>]((?:.|[\n\r])*)[<]\/div[>]\s*$/;
36
36
 
37
37
  import slideshow from "{{ 'assets/js/layout/remark_slideshow.mjs' | relative_url }}";
38
38
 
@@ -40,16 +40,24 @@ layout: default
40
40
  presentationFrame.src = {{ frame_resource_url | jsonify }};
41
41
  window.presentationFrameLoaded = false;
42
42
 
43
- let config =
44
- {{ page.remark_presentation_config | default: site.remark_presentation_config | jsonify }};
45
- config ??= {};
43
+
44
+ let siteConfig = {{ site.remark_presentation_config | jsonify }} ?? {};
45
+ let layoutConfig = {{ layout.remark_presentation_config | jsonify }} ?? {};
46
+ let pageConfig = {{ page.remark_presentation_config | jsonify }} ?? {};
47
+ let config = {};
48
+
49
+ // Merge the remark configurations. siteConfig has highest precedence.
50
+ for (let currentConfig of [siteConfig, layoutConfig, pageConfig]) {
51
+ for (let key in currentConfig) {
52
+ config[key] = currentConfig[key];
53
+ }
54
+ }
46
55
 
47
56
  // Escape the content to prevent liquid from rendering it.
48
57
  config.source = document.querySelector("#source").value;
49
58
 
50
59
  // Unwrap if surrounded by markdown-parser-disabling HTML
51
60
  let markdownDisableMatches = config.source.match(WRAPPING_DIV_EXP);
52
- console.log(markdownDisableMatches, config.source);
53
61
 
54
62
  // Replace with first capture (contents of the wrapping element).
55
63
  if (markdownDisableMatches && markdownDisableMatches.length > 0) {
@@ -59,7 +67,7 @@ layout: default
59
67
  // Library imports intended for this page: Forward to the frame.
60
68
  let libraryImports = unescape(`
61
69
  {% capture library_imports %}
62
- {% include extern_library_imports.html %}
70
+ {% include extern_library_imports.html context='remark_frame' %}
63
71
  {% endcapture %}
64
72
  {{ library_imports | url_encode | replace: "+", " " }}
65
73
  `);
@@ -82,7 +90,14 @@ layout: default
82
90
 
83
91
  // Any additional configuration scripts/html specific to remark
84
92
  presentationDoc.write(unescape(
85
- {{ page.remark_presentation_config_html | default: "" | url_encode | replace: "+", " " | jsonify }}
93
+ {{
94
+ page.remark_presentation_config_html | default: site.remark_presentation_config_html | default: "" | url_encode | replace: "+", " " | jsonify
95
+ }}
96
+ ));
97
+
98
+ // If another layout extends this layout,
99
+ presentationDoc.write(unescape(
100
+ {{ layout.remark_presentation_config_html | default: "" | url_encode | replace: "+", " " | jsonify }}
86
101
  ));
87
102
 
88
103
  presentationDoc.write(`
@@ -94,8 +109,8 @@ layout: default
94
109
  }
95
110
  </${"script"}>
96
111
  `);
97
- presentationDoc.close();
98
- (async () => {
112
+
113
+ presentationWin.initPresentation = (async () => {
99
114
  await slideshow.start(presentationFrame.contentWindow, config);
100
115
 
101
116
  // Ensure that mermaid has already been run!
@@ -103,7 +118,14 @@ layout: default
103
118
  presentationWin.mermaid.init();
104
119
  console.log("Ran mermaid!");
105
120
  }
106
- })();
121
+ });
122
+
123
+ presentationDoc.write(`
124
+ <${"script"}>
125
+ window.initPresentation();
126
+ </${"script"}>
127
+ `);
128
+ presentationDoc.close();
107
129
  };
108
130
 
109
131
  if (window.presentationFrameLoaded) {
@@ -112,4 +134,6 @@ layout: default
112
134
  else {
113
135
  presentationFrame.onload = initSlides;
114
136
  }
137
+
138
+ document.documentElement.classList.add("slideshow-mode");
115
139
  </script>
data/_sass/_layout.scss CHANGED
@@ -169,6 +169,17 @@ main.slideshow-mode {
169
169
  }
170
170
  }
171
171
 
172
+ // Make the main content large enough that the sidebar doesn't
173
+ // auto-expand.
174
+ :root.slideshow-mode {
175
+ .main-container {
176
+ max-width: 100vw;
177
+
178
+ // Transition immediately!
179
+ transition: width 0s ease, max-width 0s ease;
180
+ }
181
+ }
182
+
172
183
  // On mobile devices,
173
184
  @media screen and (max-width: $site-content-preferred-width) {
174
185
  .main-container {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hematite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henry Heino
@@ -48,6 +48,7 @@ files:
48
48
  - _includes/settings.html
49
49
  - _layouts/calendar.html
50
50
  - _layouts/default.html
51
+ - _layouts/example_custom_remark_slideshow.html
51
52
  - _layouts/home.html
52
53
  - _layouts/page.html
53
54
  - _layouts/post.html