hematite 0.1.5 → 0.1.6

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: 8764d5501c8a2e08a066ff8a3c595e6301544f302a3073505947faa226cd95d9
4
+ data.tar.gz: fd4b02059497fd70358abbd0dc7e753e4631c4c8c95347cb1cd201dc56ea9383
5
5
  SHA512:
6
- metadata.gz: 1f67a7e799a1a0bf26222a9fb9891e8265bf70d1f2e5210cdc85d0e293499c6da68ed589c401ab754ff30588d81eb8a3923a104b2343569539f01d95f0f80d39
7
- data.tar.gz: e8c5c1dcde0d2f9087a251658e5a7e5eb15dd97f2a8ac31bdeb2147fad6fac8f609d42a96d85bb36964c6f43511baa0cc5202cdd3335a11dadb8fb2729d5e398
6
+ metadata.gz: 8e00a63422072524a31554c16c036b0be5a30f3e344cb955354b452506cc735a8eaf48e3ffb77a0c553209bd74596603c44322bf1ec231f5eacea3ad6d9a2b15
7
+ data.tar.gz: ec4c74f00d80c83f563727b0415a88408285bf849b8792e454335b582ffb4905a9b06a1708f2ede5d39935b6a87531a6ba2088ccced0ac4c05d66b348ad94368
@@ -8,4 +8,37 @@
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
+ <{{ tag }} {{ options }}
40
+ {{ target.inline_options | default: "" }}
41
+ {{url_spec}}={{ url | jsonify }}
42
+ onload={{ target.onload | default: "" | jsonify }}></{{tag}}>
43
+ {% endfor %}
44
+
@@ -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,43 @@
1
+ ---
2
+ layout: remark_slideshow
3
+ additional_imports:
4
+ katex:
5
+ type: js
6
+ url: /assets/plugin/katex/katex.min.js
7
+ katex_auto_init_math:
8
+ type: js
9
+ url: /assets/plugin/katex/contrib/auto-render.min.js
10
+ onload: renderMathInElement(document.body)
11
+ inline_options: defer
12
+ comment: >-
13
+ We're passing 'defer' above because we want this script to load
14
+ _after_ the body.
15
+ katex_css:
16
+ type: css
17
+ url: /assets/plugin/katex/katex.min.css
18
+
19
+ remark_presentation_config:
20
+ navigation:
21
+ scroll: false
22
+ slideNumberFormat: "Slide %current% of %total%."
23
+
24
+ mermaid: true
25
+ remark_presentation_config_html: >-
26
+ Testing...
27
+ ---
28
+
29
+ {% comment %}
30
+ This template is an example of how to customize remark slideshows
31
+ by creating a new template.
32
+
33
+ `additional_imports` can be used on any page. In this case, the imports
34
+ are included both in the remark presentation `iframe` and in the main page.
35
+
36
+ Of course, we could include `katex` or `mermaid` here by setting `katex: true`
37
+ or `mermaid: true` in the header`, but `additional_imports` is another way to
38
+ specify this.
39
+
40
+ Note that `remark_presentation_config` is passed directly to remark.
41
+ {% endcomment %}
42
+
43
+ {{ content }}
@@ -40,16 +40,26 @@ 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
+ }
55
+
56
+ console.log(config);
46
57
 
47
58
  // Escape the content to prevent liquid from rendering it.
48
59
  config.source = document.querySelector("#source").value;
49
60
 
50
61
  // Unwrap if surrounded by markdown-parser-disabling HTML
51
62
  let markdownDisableMatches = config.source.match(WRAPPING_DIV_EXP);
52
- console.log(markdownDisableMatches, config.source);
53
63
 
54
64
  // Replace with first capture (contents of the wrapping element).
55
65
  if (markdownDisableMatches && markdownDisableMatches.length > 0) {
@@ -82,7 +92,14 @@ layout: default
82
92
 
83
93
  // Any additional configuration scripts/html specific to remark
84
94
  presentationDoc.write(unescape(
85
- {{ page.remark_presentation_config_html | default: "" | url_encode | replace: "+", " " | jsonify }}
95
+ {{
96
+ page.remark_presentation_config_html | default: site.remark_presentation_config_html | default: "" | url_encode | replace: "+", " " | jsonify
97
+ }}
98
+ ));
99
+
100
+ // If another layout extends this layout,
101
+ presentationDoc.write(unescape(
102
+ {{ layout.remark_presentation_config_html | default: "" | url_encode | replace: "+", " " | jsonify }}
86
103
  ));
87
104
 
88
105
  presentationDoc.write(`
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.6
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