Update dependencies
This commit is contained in:
10
.eslintrc
10
.eslintrc
@ -21,16 +21,16 @@
|
|||||||
"no-redeclare": [2],
|
"no-redeclare": [2],
|
||||||
"no-trailing-spaces": [2],
|
"no-trailing-spaces": [2],
|
||||||
"no-undef": [2],
|
"no-undef": [2],
|
||||||
"no-underscore-dangle": [0],
|
"no-underscore-dangle": [2],
|
||||||
"no-unused-vars": [2],
|
"no-unused-vars": [2],
|
||||||
"no-use-before-define": [0],
|
"no-use-before-define": [0],
|
||||||
"quotes": [2, "single", { "allowTemplateLiterals": true }],
|
"quotes": [2, "single", {"allowTemplateLiterals": true}],
|
||||||
"react/display-name": [2],
|
"react/display-name": [2],
|
||||||
"react/jsx-no-bind": 2,
|
"react/jsx-no-bind": 2,
|
||||||
"react/jsx-no-duplicate-props": 2,
|
"react/jsx-no-duplicate-props": 2,
|
||||||
"react/jsx-no-undef": 2,
|
"react/jsx-no-undef": 2,
|
||||||
"react/jsx-uses-react": 2,
|
|
||||||
"react/jsx-uses-vars": 2,
|
"react/jsx-uses-vars": 2,
|
||||||
|
"react/jsx-uses-react": 2,
|
||||||
"react/react-in-jsx-scope": 2,
|
"react/react-in-jsx-scope": 2,
|
||||||
"react/no-unknown-property": [2],
|
"react/no-unknown-property": [2],
|
||||||
"react/prop-types": 2,
|
"react/prop-types": 2,
|
||||||
@ -38,6 +38,10 @@
|
|||||||
"react/self-closing-comp": [2],
|
"react/self-closing-comp": [2],
|
||||||
"react/wrap-multilines": [2],
|
"react/wrap-multilines": [2],
|
||||||
"semi": [2, "always"],
|
"semi": [2, "always"],
|
||||||
|
"keyword-spacing": [2, { "before": true, "after": true }],
|
||||||
|
"space-before-blocks": 2,
|
||||||
|
"space-before-function-paren": [2, "never"],
|
||||||
|
"space-in-parens": [2, "never"],
|
||||||
"strict": [0],
|
"strict": [0],
|
||||||
"valid-typeof": 2
|
"valid-typeof": 2
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
"browserify": "^13.0.0",
|
"browserify": "^13.0.0",
|
||||||
"cssnano": "^3.4.0",
|
"cssnano": "^3.4.0",
|
||||||
"es6-promise": "^3.0.2",
|
"es6-promise": "^3.0.2",
|
||||||
"eslint": "^2.9.0",
|
"eslint": "^3.1.1",
|
||||||
"eslint-plugin-babel": "^3.0.0",
|
"eslint-plugin-babel": "^3.0.0",
|
||||||
"eslint-plugin-react": "^5.1.1",
|
"eslint-plugin-react": "^5.1.1",
|
||||||
"github-slugger": "^1.0.1",
|
"github-slugger": "^1.0.1",
|
||||||
@ -45,8 +45,8 @@
|
|||||||
"react": "^15.0.2",
|
"react": "^15.0.2",
|
||||||
"react-dom": "^15.0.2",
|
"react-dom": "^15.0.2",
|
||||||
"react-pure-render": "^1.0.2",
|
"react-pure-render": "^1.0.2",
|
||||||
"remark": "^4.2.2",
|
"remark": "^5.0.1",
|
||||||
"remark-html": "^3.0.0",
|
"remark-html": "^5.0.0",
|
||||||
"remark-slug": "^4.1.0",
|
"remark-slug": "^4.1.0",
|
||||||
"unist-util-select": "^1.3.0",
|
"unist-util-select": "^1.3.0",
|
||||||
"unist-util-visit": "^1.0.0"
|
"unist-util-visit": "^1.0.0"
|
||||||
|
@ -1,14 +1,22 @@
|
|||||||
import visit from 'unist-util-visit';
|
import visit from 'unist-util-visit';
|
||||||
|
|
||||||
import hljs from 'highlight.js/lib/highlight';
|
import hljs from 'highlight.js/lib/highlight';
|
||||||
|
import xml from 'highlight.js/lib/languages/xml';
|
||||||
import python from 'highlight.js/lib/languages/python';
|
import python from 'highlight.js/lib/languages/python';
|
||||||
import javascript from 'highlight.js/lib/languages/javascript';
|
import javascript from 'highlight.js/lib/languages/javascript';
|
||||||
import json from 'highlight.js/lib/languages/json';
|
import json from 'highlight.js/lib/languages/json';
|
||||||
|
import java from 'highlight.js/lib/languages/java';
|
||||||
|
import objectivec from 'highlight.js/lib/languages/objectivec';
|
||||||
|
import swift from 'highlight.js/lib/languages/swift';
|
||||||
import bash from 'highlight.js/lib/languages/bash';
|
import bash from 'highlight.js/lib/languages/bash';
|
||||||
|
|
||||||
hljs.registerLanguage('python', python);
|
hljs.registerLanguage('python', python);
|
||||||
|
hljs.registerLanguage('xml', xml);
|
||||||
hljs.registerLanguage('javascript', javascript);
|
hljs.registerLanguage('javascript', javascript);
|
||||||
hljs.registerLanguage('json', json);
|
hljs.registerLanguage('json', json);
|
||||||
|
hljs.registerLanguage('objc', objectivec);
|
||||||
|
hljs.registerLanguage('swift', swift);
|
||||||
|
hljs.registerLanguage('java', java);
|
||||||
hljs.registerLanguage('bash', bash);
|
hljs.registerLanguage('bash', bash);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -17,22 +25,10 @@ hljs.registerLanguage('bash', bash);
|
|||||||
*/
|
*/
|
||||||
export default function attacher() {
|
export default function attacher() {
|
||||||
function visitor(node) {
|
function visitor(node) {
|
||||||
if (!node.lang) {
|
if (node.lang) {
|
||||||
return;
|
node.type = 'html';
|
||||||
|
node.value = `<pre class='hljs'>${hljs.highlightAuto(node.value, [node.lang]).value}</pre>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
let data = node.data;
|
|
||||||
|
|
||||||
if (!data) {
|
|
||||||
node.data = data = {};
|
|
||||||
}
|
|
||||||
|
|
||||||
data.htmlContent = hljs.highlightAuto(node.value, [node.lang]).value;
|
|
||||||
data.htmlAttributes = data.htmlAttributes || {};
|
|
||||||
data.htmlAttributes.class = [
|
|
||||||
'hljs',
|
|
||||||
data.htmlAttributes.class
|
|
||||||
].filter(Boolean).join(' ');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ast => visit(ast, 'code', visitor);
|
return ast => visit(ast, 'code', visitor);
|
||||||
|
@ -34,7 +34,7 @@ function extractSections(ast) {
|
|||||||
|
|
||||||
var slugs = {};
|
var slugs = {};
|
||||||
describe('global rules', () => {
|
describe('global rules', () => {
|
||||||
var ast = remark.parse(allPages);
|
var ast = remark().parse(allPages);
|
||||||
var seen = {};
|
var seen = {};
|
||||||
/**
|
/**
|
||||||
* Check that titles are unique. This is to ensure that permalinks
|
* Check that titles are unique. This is to ensure that permalinks
|
||||||
@ -58,7 +58,7 @@ describe('content', () => {
|
|||||||
fs.readdirSync('./content').forEach(function(file) {
|
fs.readdirSync('./content').forEach(function(file) {
|
||||||
describe(file, () => {
|
describe(file, () => {
|
||||||
var content = fs.readFileSync('./content/' + file, 'utf8');
|
var content = fs.readFileSync('./content/' + file, 'utf8');
|
||||||
var ast = remark.parse(content);
|
var ast = remark().parse(content);
|
||||||
|
|
||||||
it('links are valid', function() {
|
it('links are valid', function() {
|
||||||
visit(ast, 'link', node => {
|
visit(ast, 'link', node => {
|
||||||
|
Reference in New Issue
Block a user