jekyll-mathjax-csp 1.3.1 → 2.0.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 +4 -4
- data/README.md +17 -41
- data/bin/mathjaxify +157 -0
- data/lib/jekyll-mathjax-csp.rb +68 -79
- metadata +9 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3cfec3c03b281adbf01ba53747ec25305c97542f8ed28c19dc1274f081c400ed
|
4
|
+
data.tar.gz: 96cb8d4012725a10c8d0b5e90cad63c7d2f7930180587d98221e4fa8c4d43085
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a77f77aba3d98d53a9742952d1df2403161ac5f77529577c283d878981fc173741fcf6c70657c2672b07b93d3ed251d1cd0699a96181cd82dad9959a518aa31
|
7
|
+
data.tar.gz: 6ae23704a48e987c4f55e5795e0d363f5a48d44f214f80be5b65811918f296bc2f20226ddb7be750078e0aae40167c6464a396dac4a8357a1509a2f9bebb47ac
|
data/README.md
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
# jekyll-mathjax-csp
|
2
2
|
|
3
|
-
Render math on the server using [MathJax
|
3
|
+
Render math on the server using the [MathJax 3 node API](https://github.com/mathjax/MathJax-demos-node), while maintaining a strict [Content Security Policy (CSP)](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP) without `'unsafe-inline'`.
|
4
4
|
|
5
5
|
While MathJax is well equipped to render beautiful math in a browser, letting it run in the client has two distinctive disadvantages: It is quite CPU-intensive and crucially relies on inline `style` attributes and elements. This Jekyll plugin aims to resolve both issues at once by rendering formulas to SVG images on the server, extracting all generated `style` attributes into a single `<style>` element in the head of the page and computing a hash over its content that can then be added as a CSP `style-src`.
|
6
6
|
|
7
|
-
The plugin runs the output of Jekyll's markdown parser [kramdown](http://kramdown.gettalong.org/) through the
|
7
|
+
The plugin runs the output of Jekyll's markdown parser [kramdown](http://kramdown.gettalong.org/) through the [MathJax 3 node API](https://github.com/mathjax/MathJax-demos-node) and thus behaves exactly as client-side MathJax in SVG rendering mode would.
|
8
8
|
|
9
9
|
## Usage
|
10
10
|
|
11
|
-
1. Install the npm
|
11
|
+
1. Install the npm packages `mathjax-full` and `yargs` from your top-level Jekyll directory:
|
12
12
|
|
13
13
|
```bash
|
14
14
|
npm init -f # only if you don't have a package.json yet
|
15
|
-
npm install mathjax-
|
15
|
+
npm install mathjax-full yargs
|
16
16
|
```
|
17
17
|
|
18
18
|
2. Install `jekyll-mathjax-csp`:
|
@@ -39,53 +39,29 @@ The plugin runs the output of Jekyll's markdown parser [kramdown](http://kramdow
|
|
39
39
|
|
40
40
|
## Dependencies
|
41
41
|
|
42
|
-
* `mathjax-
|
42
|
+
* `mathjax-full` (npm): 3.0+
|
43
|
+
* `yargs` (npm): 16.1.0+
|
43
44
|
* `html-pipeline`: 2.3+
|
44
45
|
* `jekyll`: 3.0+
|
45
46
|
|
46
47
|
## Configuration
|
47
48
|
|
48
|
-
|
49
|
-
|
50
|
-
```yaml
|
51
|
-
mathjax_csp:
|
52
|
-
linebreaks: false
|
53
|
-
single_dollars: false
|
54
|
-
format: AsciiMath,TeX,MathML
|
55
|
-
font: TeX
|
56
|
-
semantics: false
|
57
|
-
notexthints: false
|
58
|
-
output: SVG
|
59
|
-
eqno: none
|
60
|
-
ex_size: 6
|
61
|
-
width: 100
|
62
|
-
extensions: ""
|
63
|
-
font_url: "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS"
|
64
|
-
strip_css: false
|
65
|
-
```
|
66
|
-
'mathjax-node-page' adds a fixed inline stylesheet to every page containing math. If you want to serve this stylesheet as an external `.css`, you can advise the plugin to strip it from the output by adding the following lines to your `_config.yml`:
|
49
|
+
MathJax adds a fixed inline stylesheet to every page containing math. If you want to serve this stylesheet as an external `.css`, you can advise the plugin to strip it from the output by adding the following lines to your `_config.yml`:
|
67
50
|
|
68
51
|
```yaml
|
69
52
|
mathjax_csp:
|
70
53
|
strip_css: true
|
71
54
|
```
|
72
55
|
|
73
|
-
|
74
|
-
|
75
|
-
| Key | Description
|
76
|
-
| ---------------- |
|
77
|
-
| `
|
78
|
-
| `
|
79
|
-
| `
|
80
|
-
| `
|
81
|
-
|
82
|
-
| `notexthints` | For TeX input and MathML output, don't add TeX-specific classes | `false` |
|
83
|
-
| `output` | Output format: SVG, CommonHTML, or MML | `SVG` |
|
84
|
-
| `eqno` | Equation number style (none, AMS, or all) | `none` |
|
85
|
-
| `ex_size` | Ex-size, in pixels | `6` |
|
86
|
-
| `width` | Width of equation container in `ex`. Used for line-breaking | `100` |
|
87
|
-
| `extensions` | Extra MathJax extensions (e.g. `Safe,Tex/noUndefined`) | `""` |
|
88
|
-
| `font_url` | URL to use for web fonts | `https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/fonts/HTML-CSS` |
|
56
|
+
Other configuration options for MathJax are also available:
|
57
|
+
|
58
|
+
| Key | Description | Default |
|
59
|
+
| ---------------- | ---------------------------------------------- | ------- |
|
60
|
+
| `em_size` | Em-size, in pixels | `12` |
|
61
|
+
| `ex_size` | Ex-size, in pixels | `6` |
|
62
|
+
| `single_dollars` | Allow single-dollar delimiters for inline math | `false` |
|
63
|
+
| `output` | Output format: `SVG` or `CommonHTML` | `SVG` |
|
64
|
+
|
89
65
|
|
90
66
|
## Local testing
|
91
67
|
|
@@ -110,4 +86,4 @@ Note that this cannot be used with frame-ancestors, report-uri, or sandbox.
|
|
110
86
|
|
111
87
|
## License
|
112
88
|
|
113
|
-
MIT
|
89
|
+
MIT
|
data/bin/mathjaxify
ADDED
@@ -0,0 +1,157 @@
|
|
1
|
+
#! /usr/bin/env node
|
2
|
+
|
3
|
+
// The MIT License (MIT)
|
4
|
+
// =====================
|
5
|
+
//
|
6
|
+
// Copyright © 2018 Fabian Henneke
|
7
|
+
//
|
8
|
+
// Permission is hereby granted, free of charge, to any person
|
9
|
+
// obtaining a copy of this software and associated documentation
|
10
|
+
// files (the “Software”), to deal in the Software without
|
11
|
+
// restriction, including without limitation the rights to use,
|
12
|
+
// copy, modify, merge, publish, distribute, sublicense, and/or sell
|
13
|
+
// copies of the Software, and to permit persons to whom the
|
14
|
+
// Software is furnished to do so, subject to the following
|
15
|
+
// conditions:
|
16
|
+
//
|
17
|
+
// The above copyright notice and this permission notice shall be
|
18
|
+
// included in all copies or substantial portions of the Software.
|
19
|
+
//
|
20
|
+
// THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
|
21
|
+
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
22
|
+
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
23
|
+
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
24
|
+
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
25
|
+
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
26
|
+
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
27
|
+
// OTHER DEALINGS IN THE SOFTWARE.
|
28
|
+
|
29
|
+
/*************************************************************************
|
30
|
+
* Modified from MathJax-demos-node direct/tex2svg-page by Fabian Henneke
|
31
|
+
*
|
32
|
+
* Original copyright and licensing information:
|
33
|
+
* ----------------------------------------------------------------------
|
34
|
+
*
|
35
|
+
* Copyright (c) 2018 The MathJax Consortium
|
36
|
+
*
|
37
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
38
|
+
* you may not use this file except in compliance with the License.
|
39
|
+
* You may obtain a copy of the License at
|
40
|
+
*
|
41
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
42
|
+
*
|
43
|
+
* Unless required by applicable law or agreed to in writing, software
|
44
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
45
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
46
|
+
* See the License for the specific language governing permissions and
|
47
|
+
* limitations under the License.
|
48
|
+
*/
|
49
|
+
|
50
|
+
//
|
51
|
+
// Load the packages needed for MathJax
|
52
|
+
//
|
53
|
+
|
54
|
+
const {mathjax} = require('mathjax-full/js/mathjax.js');
|
55
|
+
const {TeX} = require('mathjax-full/js/input/tex.js');
|
56
|
+
const {SVG} = require('mathjax-full/js/output/svg.js');
|
57
|
+
const {CHTML} = require('mathjax-full/js/output/chtml.js');
|
58
|
+
const {liteAdaptor} = require('mathjax-full/js/adaptors/liteAdaptor.js');
|
59
|
+
const {RegisterHTMLHandler} = require('mathjax-full/js/handlers/html.js');
|
60
|
+
const {AssistiveMmlHandler} = require('mathjax-full/js/a11y/assistive-mml.js');
|
61
|
+
|
62
|
+
const {AllPackages} = require('mathjax-full/js/input/tex/AllPackages.js');
|
63
|
+
|
64
|
+
require('mathjax-full/js/util/entities/all.js');
|
65
|
+
|
66
|
+
//
|
67
|
+
// Get the command-line arguments
|
68
|
+
//
|
69
|
+
var argv = require('yargs')
|
70
|
+
.demand(0).strict()
|
71
|
+
.usage('$0 [options] < input.json > output.json')
|
72
|
+
.options({
|
73
|
+
em: {
|
74
|
+
default: 12,
|
75
|
+
describe: 'em-size in pixels'
|
76
|
+
},
|
77
|
+
ex: {
|
78
|
+
default: 6,
|
79
|
+
describe: 'ex-size in pixels'
|
80
|
+
},
|
81
|
+
singleDollars: {
|
82
|
+
default: false,
|
83
|
+
type: 'boolean'
|
84
|
+
},
|
85
|
+
output: {
|
86
|
+
default: 'SVG',
|
87
|
+
choices: ['SVG', 'CommonHTML']
|
88
|
+
}
|
89
|
+
})
|
90
|
+
.argv;
|
91
|
+
|
92
|
+
//
|
93
|
+
// Read input JSON from stdin
|
94
|
+
//
|
95
|
+
const inputDocs = JSON.parse(require('fs').readFileSync(0, 'utf8'));
|
96
|
+
|
97
|
+
//
|
98
|
+
// Create DOM adaptor and register it for HTML documents
|
99
|
+
//
|
100
|
+
const adaptor = liteAdaptor({fontSize: argv.em});
|
101
|
+
AssistiveMmlHandler(RegisterHTMLHandler(adaptor));
|
102
|
+
|
103
|
+
//
|
104
|
+
// Create input and output jax and a document using them on the content from the HTML file
|
105
|
+
//
|
106
|
+
function getInput() {
|
107
|
+
const options = {packages: AllPackages};
|
108
|
+
if (argv.singleDollars) {
|
109
|
+
options.inlineMath = [['$', '$'], ['\\(', '\\)']]
|
110
|
+
}
|
111
|
+
return new TeX(options);
|
112
|
+
}
|
113
|
+
|
114
|
+
function getOutput() {
|
115
|
+
const options = {exFactor: argv.ex / argv.em};
|
116
|
+
switch (argv.output) {
|
117
|
+
case 'SVG':
|
118
|
+
return new SVG({...options, fontCache: 'global'});
|
119
|
+
case 'CommonHTML':
|
120
|
+
return new CHTML({...options, fontURL: 'https://cdn.jsdelivr.net/npm/mathjax@3/es5/output/chtml/fonts/woff-v2'});
|
121
|
+
default:
|
122
|
+
throw new Error('Unrecognized output format: ' + argv.output);
|
123
|
+
}
|
124
|
+
}
|
125
|
+
|
126
|
+
const outputDocs = {};
|
127
|
+
|
128
|
+
// For each input path and HTML doc
|
129
|
+
Object.keys(inputDocs).forEach((path) => {
|
130
|
+
console.error("mathjaxify:", path);
|
131
|
+
const inputHTML = inputDocs[path];
|
132
|
+
const html = mathjax.document(inputHTML, {InputJax: getInput(), OutputJax: getOutput()});
|
133
|
+
|
134
|
+
//
|
135
|
+
// Typeset the document
|
136
|
+
//
|
137
|
+
html.render();
|
138
|
+
|
139
|
+
//
|
140
|
+
// If no math was found on the page, remove the stylesheet and font cache (if any)
|
141
|
+
//
|
142
|
+
if (argv.output === "SVG" && html.math.toArray().length === 0) {
|
143
|
+
adaptor.remove(html.outputJax.svgStyles);
|
144
|
+
const cache = adaptor.elementById(adaptor.body(html.document), 'MJX-SVG-global-cache');
|
145
|
+
if (cache) adaptor.remove(cache);
|
146
|
+
}
|
147
|
+
|
148
|
+
//
|
149
|
+
// Store the resulting HTML in the output
|
150
|
+
//
|
151
|
+
outputDocs[path] = adaptor.doctype(html.document)
|
152
|
+
+ "\n"
|
153
|
+
+ adaptor.outerHTML(adaptor.root(html.document));
|
154
|
+
});
|
155
|
+
|
156
|
+
// Write out all the documents in JSON format
|
157
|
+
console.log(JSON.stringify(outputDocs));
|
data/lib/jekyll-mathjax-csp.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
#
|
1
|
+
# coding: utf-8
|
2
|
+
# Server-side, CSP-aware math rendering for Jekyll using MathJax's node API
|
2
3
|
#
|
3
4
|
# The MIT License (MIT)
|
4
5
|
# =====================
|
@@ -35,46 +36,34 @@ require "set"
|
|
35
36
|
|
36
37
|
module Jekyll
|
37
38
|
|
38
|
-
# Run Jekyll documents through
|
39
|
+
# Run Jekyll documents through MathJax's node engine, transform style attributes into inline style
|
39
40
|
# tags and compute their hashes
|
40
41
|
class Mathifier
|
41
42
|
MATH_TAG_REGEX = /(<script[^>]*type="math\/tex|\\\[.*\\\]|\\\(.*\\\))/im
|
42
43
|
|
43
44
|
FIELDS = {
|
44
|
-
"
|
45
|
-
"font" => "--font",
|
46
|
-
"ouput" => "--output",
|
47
|
-
"equation_number" => "--eqno",
|
48
|
-
"output" => "--output",
|
49
|
-
"eqno" => "--eqno",
|
45
|
+
"em_size" => "--em",
|
50
46
|
"ex_size" => "--ex",
|
51
|
-
"
|
52
|
-
"
|
53
|
-
"font_url" => "--fontURL"
|
54
|
-
}
|
55
|
-
FLAGS = {
|
56
|
-
"linebreaks" => "--linebreaks",
|
57
|
-
"single_dollars" => "--dollars",
|
58
|
-
"semantics" => "--semantics",
|
59
|
-
"notexthints" => "--notexthints"
|
47
|
+
"single_dollars" => "--singleDollars",
|
48
|
+
"output" => "--output",
|
60
49
|
}
|
61
50
|
|
62
51
|
class << self
|
63
52
|
attr_accessor :csp_hashes
|
64
53
|
|
65
|
-
# Extract all style attributes from SVG elements and replace them
|
66
|
-
# deterministic name
|
54
|
+
# Extract all style attributes from SVG and container elements and replace them with a new
|
55
|
+
# CSS class with a deterministic name
|
67
56
|
def extractStyleAttributes(parsed_doc)
|
68
57
|
style_attributes = {}
|
69
|
-
|
70
|
-
for
|
71
|
-
style_attribute =
|
58
|
+
styled_tags = parsed_doc.css("svg[style],mjx-container[style]")
|
59
|
+
for styled_tag in styled_tags do
|
60
|
+
style_attribute = styled_tag["style"]
|
72
61
|
digest = Digest::MD5.hexdigest(style_attribute)[0..15]
|
73
62
|
style_attributes[digest] = style_attribute
|
74
63
|
|
75
64
|
digest_class = "mathjax-inline-#{digest}"
|
76
|
-
|
77
|
-
|
65
|
+
styled_tag["class"] = "#{styled_tag["class"] || ""} #{digest_class}"
|
66
|
+
styled_tag.remove_attribute("style")
|
78
67
|
end
|
79
68
|
return style_attributes
|
80
69
|
end
|
@@ -96,71 +85,73 @@ module Jekyll
|
|
96
85
|
hashStyleTag(style_tag)
|
97
86
|
end
|
98
87
|
|
99
|
-
# Run
|
100
|
-
def
|
88
|
+
# Run the MathJax node backend on a JSON input containing an file: HTML map
|
89
|
+
def run_mathjaxify(config, input)
|
101
90
|
mathified = ""
|
102
91
|
exit_status = 0
|
103
|
-
|
104
|
-
command = "node_modules/mathjax-node-page/bin/mjpage"
|
92
|
+
command = "node #{Gem.bin_path("jekyll-mathjax-csp", "mathjaxify")}"
|
105
93
|
|
106
94
|
FIELDS.each do |name, flag|
|
107
95
|
unless config[name].nil?
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
unless config[name].nil?
|
114
|
-
command << " " << flag
|
96
|
+
if [true, false].include? config[name]
|
97
|
+
command << " " << flag
|
98
|
+
else
|
99
|
+
command << " " << flag << " " << config[name].to_s
|
100
|
+
end
|
115
101
|
end
|
116
102
|
end
|
117
103
|
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
mathified.concat(line)
|
124
|
-
}
|
125
|
-
exit_status = t.value
|
126
|
-
}
|
127
|
-
return mathified unless exit_status != 0
|
128
|
-
Jekyll.logger.abort_with "mathjax_csp:", "'node_modules/mathjax-node-page/mjpage' not found"
|
129
|
-
rescue
|
130
|
-
Jekyll.logger.abort_with "mathjax_csp:", "Failed to execute 'node_modules/mathjax-node-page/mjpage'"
|
131
|
-
end
|
132
|
-
|
104
|
+
node_path = Dir.pwd + "/node_modules"
|
105
|
+
Jekyll.logger.info "mathjax_csp:", "starting node #{command}"
|
106
|
+
mathified, status = Open3.capture2({"NODE_PATH" => node_path}, command, stdin_data: input)
|
107
|
+
return mathified unless status != 0
|
108
|
+
Jekyll.logger.abort_with "mathjax_csp:", "Failed to execute 'bin/mathjaxify'"
|
133
109
|
end
|
134
110
|
|
135
|
-
# Render math
|
136
|
-
def mathify(
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
111
|
+
# Render math in batch for all documents
|
112
|
+
def mathify(docs, config)
|
113
|
+
docs = docs.select { |d| Jekyll::Mathifier.mathable?(d) } # can be mathified?
|
114
|
+
.select { |d| MATH_TAG_REGEX.match?(d.output) } # needs mathifying?
|
115
|
+
.reduce({}) { |h, d| h.merge!(d.path => d) } # use #path to identify a doc
|
116
|
+
return if docs.empty?
|
117
|
+
|
118
|
+
Jekyll.logger.info "mathjax_csp:", "Found #{docs.length} documents."
|
119
|
+
|
120
|
+
docs.each do |path, doc|
|
121
|
+
Jekyll.logger.info "Checking math:", path
|
122
|
+
parsed_doc = Nokogiri::HTML::Document.parse(doc.output)
|
123
|
+
# Ensure that all styles we pick up weren't present before MathJax ran
|
124
|
+
unless parsed_doc.css("svg[style],mjx-container[style]").empty?
|
125
|
+
Jekyll.logger.error "mathjax_csp:", "Inline style on <svg> or <mjx-container> element present"
|
126
|
+
Jekyll.logger.error "", "before rendering math due to misconfiguration or server-side"
|
127
|
+
Jekyll.logger.abort_with "", "style injection."
|
128
|
+
end
|
145
129
|
end
|
146
130
|
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
131
|
+
mathjaxify_input = docs.reduce({}) { |h, (path, doc)| h.merge!(path => doc.output) }
|
132
|
+
.to_json
|
133
|
+
mathified_docs = JSON.parse(run_mathjaxify(config, mathjaxify_input))
|
134
|
+
|
135
|
+
mathified_docs.each do |path, mathified_html|
|
136
|
+
parsed_doc = Nokogiri::HTML::Document.parse(mathified_html)
|
137
|
+
last_child = parsed_doc.at_css("head").last_element_child()
|
138
|
+
if last_child.name == "style"
|
139
|
+
# Set strip_css to true in _config.yml if you load the styles MathJax adds to the head
|
140
|
+
# from an external *.css file
|
141
|
+
if config["strip_css"]
|
142
|
+
Jekyll.logger.info "", "Remember to <link> in external stylesheet!"
|
143
|
+
last_child.remove
|
144
|
+
else
|
145
|
+
hashStyleTag(last_child)
|
146
|
+
end
|
158
147
|
end
|
148
|
+
|
149
|
+
style_attributes = extractStyleAttributes(parsed_doc)
|
150
|
+
compileStyleElement(parsed_doc, style_attributes)
|
151
|
+
docs[path].output = parsed_doc.to_html
|
159
152
|
end
|
160
153
|
|
161
|
-
|
162
|
-
compileStyleElement(parsed_doc, style_attributes)
|
163
|
-
doc.output = parsed_doc.to_html
|
154
|
+
Jekyll.logger.info "mathjax_csp:", "Mathified #{mathified_docs.length} documents."
|
164
155
|
end
|
165
156
|
|
166
157
|
def mathable?(doc)
|
@@ -215,12 +206,10 @@ Jekyll::Hooks.register [:documents, :pages], :pre_render do |doc|
|
|
215
206
|
Jekyll::MathJaxSourcesTag.unrendered_docs[doc.relative_path] = doc.content
|
216
207
|
end
|
217
208
|
|
218
|
-
# Replace math blocks with SVG renderings using
|
209
|
+
# Replace math blocks with SVG renderings using mathjaxify and collect inline styles in a
|
219
210
|
# single <style> element
|
220
|
-
Jekyll::Hooks.register
|
221
|
-
|
222
|
-
Jekyll::Mathifier.mathify(doc, doc.site.config["mathjax_csp"] || {})
|
223
|
-
end
|
211
|
+
Jekyll::Hooks.register :site, :post_render do |site|
|
212
|
+
Jekyll::Mathifier.mathify(site.posts.docs + site.pages, site.config["mathjax_csp"] || {})
|
224
213
|
end
|
225
214
|
|
226
215
|
# Run over all documents with {% mathjax_sources %} Liquid tags again and insert the list of CSP
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-mathjax-csp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- Fabian
|
7
|
+
- Fabian Meumertzheim
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-07-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: html-pipeline
|
@@ -45,15 +45,17 @@ dependencies:
|
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: '5.0'
|
47
47
|
description: Server-side MathJax rendering for Jekyll with a strict CSP
|
48
|
-
email: fabian@
|
49
|
-
executables:
|
48
|
+
email: fabian@meumertzhe.im
|
49
|
+
executables:
|
50
|
+
- mathjaxify
|
50
51
|
extensions: []
|
51
52
|
extra_rdoc_files:
|
52
53
|
- README.md
|
53
54
|
files:
|
54
55
|
- README.md
|
56
|
+
- bin/mathjaxify
|
55
57
|
- lib/jekyll-mathjax-csp.rb
|
56
|
-
homepage: https://github.com/
|
58
|
+
homepage: https://github.com/fmeum/jekyll-mathjax-csp
|
57
59
|
licenses:
|
58
60
|
- MIT
|
59
61
|
metadata: {}
|
@@ -72,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
72
74
|
- !ruby/object:Gem::Version
|
73
75
|
version: '0'
|
74
76
|
requirements: []
|
75
|
-
rubygems_version: 3.
|
77
|
+
rubygems_version: 3.1.2
|
76
78
|
signing_key:
|
77
79
|
specification_version: 4
|
78
80
|
summary: Server-side MathJax & CSP for Jekyll
|