Skip to content

Commit c609459

Browse files
Init
0 parents  commit c609459

File tree

4 files changed

+133
-0
lines changed

4 files changed

+133
-0
lines changed

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020 «NexT»
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# NexT Plugins
2+
3+
[![Npm Version](https://img.shields.io/npm/v/@next-theme/plugins?style=flat-square)](https://npmjs.org/package/@next-theme/plugins)
4+
[![Npm Downloads Month](https://img.shields.io/npm/dm/@next-theme/plugins?style=flat-square)](https://npmjs.org/package/@next-theme/plugins)
5+
[![Npm Downloads Total](https://img.shields.io/npm/dt/@next-theme/plugins?style=flat-square)](https://npmjs.org/package/@next-theme/plugins)
6+
[![License](https://img.shields.io/npm/l/@next-theme/plugins?style=flat-square)](https://npmjs.org/package/@next-theme/plugins)
7+
8+
Plugins for Hexo theme NexT.
9+
10+
## Installation
11+
12+
``` bash
13+
$ npm install @next-theme/plugins
14+
```

index.js

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
const { readFileSync } = require('fs');
2+
const { dirname } = require('path');
3+
4+
function readFile(package, file) {
5+
const dir = dirname(require.resolve(`${package}/package.json`));
6+
let data;
7+
try {
8+
data = readFileSync(`${dir}/${file}`);
9+
} catch (err) {
10+
console.error(err.message);
11+
}
12+
return data;
13+
}
14+
15+
const plugins = {
16+
prism: ['prismjs', 'components/prism-core.min.js'],
17+
prism_autoloader: ['prismjs', 'plugins/autoloader/prism-autoloader.min.js'],
18+
prism_autoloader: ['prismjs', 'plugins/line-numbers/prism-line-numbers.min.js'],
19+
mathjax: ['mathjax', 'es5/tex-mml-chtml.js'],
20+
katex: ['katex', 'dist/katex.min.css'],
21+
copy_tex_js: ['katex', 'dist/contrib/copy-tex.min.js'],
22+
copy_tex_css: ['katex', 'dist/contrib/copy-tex.min.css'],
23+
jquery: ['jquery', 'dist/jquery.min.js'],
24+
fancybox: ['@fancyapps/fancybox', 'dist/jquery.fancybox.min.js'],
25+
fancybox_css: ['@fancyapps/fancybox', 'dist/jquery.fancybox.min.css'],
26+
mediumzoom: ['medium-zoom', 'dist/medium-zoom.min.js'],
27+
lazyload: ['lozad', 'dist/lozad.min.js'],
28+
pangu: ['pangu', 'dist/browser/pangu.min.js'],
29+
quicklink: ['quicklink', 'dist/quicklink.umd.js'],
30+
disqusjs_js: ['disqusjs', 'dist/disqus.js'],
31+
disqusjs_css: ['disqusjs', 'dist/disqusjs.css'],
32+
valine: ['valine', 'dist/valine.min.js'],
33+
gitalk_js: ['gitalk', 'dist/gitalk.min.js'],
34+
gitalk_css: ['gitalk', 'dist/gitalk.css'],
35+
algolia_search: ['algoliasearch', 'dist/algoliasearch-lite.umd.js'],
36+
instant_search: ['instantsearch.js', 'dist/instantsearch.production.min.js'],
37+
mermaid: ['mermaid', 'dist/mermaid.min.js'],
38+
pace: ['pace-js', 'pace.min.js'],
39+
pace_css: ['pace-js', 'themes/blue/pace-theme-minimal.css'],
40+
canvas_ribbon: ['ribbon.js', 'dist/ribbon.min.js']
41+
};
42+
43+
module.exports = function(hexo) {
44+
const vendors = {};
45+
const generator = [];
46+
for (const [key, item] of Object.entries(plugins)) {
47+
const path = 'lib/' + item.join('/');
48+
let data = readFile(...item);
49+
if (data) {
50+
vendors[key] = path;
51+
generator.push({
52+
path,
53+
data
54+
});
55+
}
56+
}
57+
return {
58+
vendors,
59+
generator
60+
}
61+
}

package.json

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"name": "@next-theme/plugins",
3+
"version": "0.0.1",
4+
"description": "Plugins for Hexo theme NexT.",
5+
"main": "index.js",
6+
"repository": "https://github.com/next-theme/plugins",
7+
"engines": {
8+
"node": ">=10.9.0"
9+
},
10+
"keywords": [
11+
"hexo",
12+
"hexo generator",
13+
"hexo plugin"
14+
],
15+
"author": "Mimi <[email protected]> (https://zhangshuqiao.org)",
16+
"license": "MIT",
17+
"dependencies": {
18+
"@fancyapps/fancybox": "^3.5.7",
19+
"algoliasearch": "^4.3.0",
20+
"disqusjs": "^1.3.0",
21+
"gitalk": "^1.6.2",
22+
"instantsearch.js": "^4.7.0",
23+
"jquery": "^3.5.1",
24+
"katex": "^0.12.0",
25+
"lozad": "^1.15.0",
26+
"mathjax": "^3.0.5",
27+
"medium-zoom": "^1.0.6",
28+
"mermaid": "^8.5.2",
29+
"pace-js": "^1.0.2",
30+
"pangu": "^4.0.7",
31+
"prism-themes": "^1.4.0",
32+
"prismjs": "^1.20.0",
33+
"quicklink": "^2.0.0",
34+
"ribbon.js": "^1.0.2",
35+
"valine": "^1.4.14"
36+
}
37+
}

0 commit comments

Comments
 (0)