summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/generate/plugin.js10
-rw-r--r--package.json3
-rw-r--r--theme/templates/site.html12
3 files changed, 18 insertions, 7 deletions
diff --git a/lib/generate/plugin.js b/lib/generate/plugin.js
index d1becd4..cd85402 100644
--- a/lib/generate/plugin.js
+++ b/lib/generate/plugin.js
@@ -2,6 +2,7 @@ var _ = require("lodash");
var Q = require("q");
var semver = require("semver");
var path = require("path");
+var url = require("url");
var fs = require("./fs");
var pkg = require("../../package.json");
@@ -42,9 +43,9 @@ Plugin.prototype.getResources = function(resource) {
}
return _.chain(this.infos.book[resource])
.map(function(resource) {
- return {
- "path": this.name+"/"+resource
- }
+ var parsed = url.parse(resource);
+ if (parsed.protocol) return {"url": resource}
+ else return { "path": this.name+"/"+resource };
}.bind(this))
.value();
};
@@ -172,7 +173,8 @@ Plugin.fromList = function(names) {
// Default plugins
Plugin.defaults = [
- "mixpanel"
+ "mixpanel",
+ "mathjax"
];
module.exports = Plugin; \ No newline at end of file
diff --git a/package.json b/package.json
index 686bbb7..d54c271 100644
--- a/package.json
+++ b/package.json
@@ -20,7 +20,8 @@
"semver": "2.2.1",
"gitbook-plugin": "0.0.1",
- "gitbook-plugin-mixpanel": "0.0.1"
+ "gitbook-plugin-mixpanel": "0.0.1",
+ "gitbook-plugin-mathjax": "0.0.1"
},
"devDependencies": {
"mocha": "1.18.2",
diff --git a/theme/templates/site.html b/theme/templates/site.html
index ef74bd2..af70398 100644
--- a/theme/templates/site.html
+++ b/theme/templates/site.html
@@ -39,13 +39,21 @@
{% block javascript %}
{% parent %}
{% for resource in plugins.resources.js %}
-<script src="{{ staticBase }}/plugins/{{ resource.path }}"></script>
+ {% if resource.url %}
+ <script src="{{ resource.url }}"></script>
+ {% else %}
+ <script src="{{ staticBase }}/plugins/{{ resource.path }}"></script>
+ {% endif %}
{% endfor %}
{% endblock %}
{% block style %}
{% parent %}
{% for resource in plugins.resources.css %}
-<link rel="stylesheet" href="{{ staticBase }}/plugins/{{ resource.path }}">
+ {% if resource.url %}
+ <link rel="stylesheet" href="{{ resource.url }}">
+ {% else %}
+ <link rel="stylesheet" href="{{ staticBase }}/plugins/{{ resource.path }}">
+ {% endif %}
{% endfor %}
{% endblock %}