mirror of
https://github.com/showdownjs/showdown.git
synced 2024-03-22 13:30:55 +08:00
Update dependencies to enable Greenkeeper 🌴 (#335)
adapt code to updated dependencies
This commit is contained in:
parent
1832b7f721
commit
b5e46fdb8d
27
.eslintrc.json
Normal file
27
.eslintrc.json
Normal file
@ -0,0 +1,27 @@
|
||||
{
|
||||
"rules": {
|
||||
"indent": [2, 2, {"SwitchCase": 1, "VariableDeclarator": 2}],
|
||||
"curly": [2, "all"],
|
||||
"operator-linebreak": [2, "after"],
|
||||
"camelcase": [2, {"properties": "never"}],
|
||||
"quotes": [2, "single"],
|
||||
"no-multi-str": 2,
|
||||
"no-mixed-spaces-and-tabs": 2,
|
||||
"no-trailing-spaces": 2,
|
||||
"space-unary-ops": [2,
|
||||
{
|
||||
"nonwords": false,
|
||||
"overrides": {}
|
||||
}
|
||||
],
|
||||
"brace-style": [2, "1tbs", {"allowSingleLine": true}],
|
||||
"keyword-spacing": [2, {}],
|
||||
"space-infix-ops": 2,
|
||||
"space-before-blocks": [2, "always"],
|
||||
"eol-last": 2,
|
||||
"space-before-function-paren": [2, "always"],
|
||||
"array-bracket-spacing": [2, "never", {"singleValue": false}],
|
||||
"space-in-parens": [2, "never"],
|
||||
"no-multiple-empty-lines": 2
|
||||
}
|
||||
}
|
3
.gitattributes
vendored
3
.gitattributes
vendored
@ -3,12 +3,13 @@
|
||||
.editorconfig export-ignore
|
||||
.gitattributes export-ignore
|
||||
.gitignore export-ignore
|
||||
.jscs.json export-ignore
|
||||
.eslintrc.json export-ignore
|
||||
.jshintignore export-ignore
|
||||
.jshintrc
|
||||
.travis.yml export-ignore
|
||||
bower.json
|
||||
Gruntfile.js export-ignore
|
||||
performance.*
|
||||
|
||||
# Line endings control
|
||||
CHANGELOG.md text
|
||||
|
89
.jscs.json
89
.jscs.json
@ -1,89 +0,0 @@
|
||||
{
|
||||
"validateIndentation": 2,
|
||||
"requireCurlyBraces": [
|
||||
"if",
|
||||
"else",
|
||||
"for",
|
||||
"while",
|
||||
"do",
|
||||
"try",
|
||||
"catch"
|
||||
],
|
||||
"requireOperatorBeforeLineBreak": true,
|
||||
"requireCamelCaseOrUpperCaseIdentifiers": true,
|
||||
"validateQuoteMarks": "'",
|
||||
"disallowMultipleLineStrings": true,
|
||||
"disallowMixedSpacesAndTabs": true,
|
||||
"disallowTrailingWhitespace": true,
|
||||
"disallowSpaceAfterPrefixUnaryOperators": true,
|
||||
"requireMultipleVarDecl": true,
|
||||
"disallowKeywordsOnNewLine": ["else"],
|
||||
"requireSpaceAfterKeywords": [
|
||||
"if",
|
||||
"else",
|
||||
"for",
|
||||
"while",
|
||||
"do",
|
||||
"switch",
|
||||
"return",
|
||||
"try",
|
||||
"catch"
|
||||
],
|
||||
"requireSpaceBeforeBinaryOperators": [
|
||||
"=",
|
||||
"+=",
|
||||
"-=",
|
||||
"*=",
|
||||
"/=",
|
||||
"%=",
|
||||
"<<=",
|
||||
">>=",
|
||||
">>>=",
|
||||
"&=",
|
||||
"|=",
|
||||
"^=",
|
||||
"+=",
|
||||
"+",
|
||||
"-",
|
||||
"*",
|
||||
"/",
|
||||
"%",
|
||||
"<<",
|
||||
">>",
|
||||
">>>",
|
||||
"&",
|
||||
"|",
|
||||
"^",
|
||||
"&&",
|
||||
"||",
|
||||
"===",
|
||||
"==",
|
||||
">=",
|
||||
"<=",
|
||||
"<",
|
||||
">",
|
||||
"!=",
|
||||
"!=="
|
||||
],
|
||||
"requireSpaceAfterBinaryOperators": true,
|
||||
"requireSpacesInConditionalExpression": true,
|
||||
"requireSpaceBeforeBlockStatements": true,
|
||||
"requireSpacesInForStatement": true,
|
||||
"requireLineFeedAtFileEnd": true,
|
||||
"requireSpacesInFunctionExpression": {
|
||||
"beforeOpeningCurlyBrace": true
|
||||
},
|
||||
"requireSpacesInAnonymousFunctionExpression": {
|
||||
"beforeOpeningRoundBrace": true,
|
||||
"beforeOpeningCurlyBrace": true
|
||||
},
|
||||
"disallowSpacesInsideObjectBrackets": "all",
|
||||
"disallowSpacesInsideArrayBrackets": "all",
|
||||
"disallowSpacesInsideParentheses": true,
|
||||
"validateJSDoc": {
|
||||
"checkParamNames": true,
|
||||
"requireParamTypes": true
|
||||
},
|
||||
"disallowMultipleLineBreaks": true,
|
||||
"disallowNewlineBeforeBlockStatements": true
|
||||
}
|
@ -13,6 +13,10 @@ cache:
|
||||
directories:
|
||||
- node_modules
|
||||
|
||||
# scripts
|
||||
script:
|
||||
- 'if [ "$TRAVIS_NODE_VERSION" == "0.12" ]; then echo "Bypassing EsLint" && grunt test-old; else echo "Running normal tests" && grunt test; fi'
|
||||
|
||||
# hooks
|
||||
notifications:
|
||||
webhooks:
|
||||
|
25
Gruntfile.js
25
Gruntfile.js
@ -73,17 +73,15 @@ module.exports = function (grunt) {
|
||||
]
|
||||
},
|
||||
|
||||
jscs: {
|
||||
eslint: {
|
||||
options: {
|
||||
config: '.jscs.json'
|
||||
config: '.eslintrc.json'
|
||||
},
|
||||
files: {
|
||||
src: [
|
||||
target: [
|
||||
'Gruntfile.js',
|
||||
'src/**/*.js',
|
||||
'test/**/*.js'
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
conventionalChangelog: {
|
||||
@ -171,7 +169,14 @@ module.exports = function (grunt) {
|
||||
|
||||
grunt.initConfig(config);
|
||||
|
||||
require('load-grunt-tasks')(grunt);
|
||||
grunt.loadNpmTasks('grunt-contrib-clean');
|
||||
grunt.loadNpmTasks('grunt-contrib-concat');
|
||||
grunt.loadNpmTasks('grunt-contrib-uglify');
|
||||
grunt.loadNpmTasks('grunt-conventional-changelog');
|
||||
grunt.loadNpmTasks('grunt-conventional-github-releaser');
|
||||
grunt.loadNpmTasks('grunt-endline');
|
||||
grunt.loadNpmTasks('grunt-simple-mocha');
|
||||
grunt.loadNpmTasks('grunt-contrib-jshint');
|
||||
|
||||
grunt.registerTask('single-test', function (grep) {
|
||||
'use strict';
|
||||
@ -195,8 +200,14 @@ module.exports = function (grunt) {
|
||||
perf.generateLogs();
|
||||
});
|
||||
|
||||
grunt.registerTask('lint', ['jshint', 'jscs']);
|
||||
grunt.registerTask('lint', function () {
|
||||
'use strict';
|
||||
grunt.loadNpmTasks('grunt-eslint');
|
||||
grunt.task.run('jshint', 'eslint');
|
||||
});
|
||||
|
||||
grunt.registerTask('test', ['clean', 'lint', 'concat:test', 'simplemocha:node', 'clean']);
|
||||
grunt.registerTask('test-old', ['concat:test', 'simplemocha:node', 'clean']);
|
||||
grunt.registerTask('performance', ['concat:test', 'performancejs', 'clean']);
|
||||
grunt.registerTask('build', ['test', 'concat:dist', 'uglify', 'endline']);
|
||||
grunt.registerTask('prep-release', ['build', 'conventionalChangelog']);
|
||||
|
@ -1,6 +1,6 @@
|
||||
![Showdown][sd-logo]
|
||||
|
||||
[](https://travis-ci.org/showdownjs/showdown) [](http://badge.fury.io/js/showdown) [](http://badge.fury.io/bo/showdown) [](https://gitter.im/showdownjs/showdown?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
[](https://travis-ci.org/showdownjs/showdown) [](http://badge.fury.io/js/showdown) [](http://badge.fury.io/bo/showdown) [](https://gitter.im/showdownjs/showdown?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [](https://greenkeeper.io/)
|
||||
|
||||
------
|
||||
|
||||
|
4
dist/showdown.js
vendored
4
dist/showdown.js
vendored
@ -469,7 +469,7 @@ function validate(extension, name) {
|
||||
if (showdown.helper.isString(ext.regex)) {
|
||||
ext.regex = new RegExp(ext.regex, 'g');
|
||||
}
|
||||
if (!ext.regex instanceof RegExp) {
|
||||
if (!(ext.regex instanceof RegExp)) {
|
||||
ret.valid = false;
|
||||
ret.error = baseMsg + '"regex" property must either be a string or a RegExp object, but ' + typeof ext.regex + ' given';
|
||||
return ret;
|
||||
@ -2419,7 +2419,7 @@ showdown.subParser('runExtension', function (ext, text, options, globals) {
|
||||
} else if (ext.regex) {
|
||||
// TODO remove this when old extension loading mechanism is deprecated
|
||||
var re = ext.regex;
|
||||
if (!re instanceof RegExp) {
|
||||
if (!(re instanceof RegExp)) {
|
||||
re = new RegExp(re, 'g');
|
||||
}
|
||||
text = text.replace(re, ext.replace);
|
||||
|
2
dist/showdown.js.map
vendored
2
dist/showdown.js.map
vendored
File diff suppressed because one or more lines are too long
4
dist/showdown.min.js
vendored
4
dist/showdown.min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/showdown.min.js.map
vendored
2
dist/showdown.min.js.map
vendored
File diff suppressed because one or more lines are too long
22
package.json
22
package.json
@ -40,24 +40,24 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"chai": "^3.5.0",
|
||||
"grunt": "^0.4.5",
|
||||
"grunt-contrib-clean": "^0.6.0",
|
||||
"grunt-contrib-concat": "^0.5.0",
|
||||
"grunt-contrib-jshint": "^0.10.0",
|
||||
"grunt-contrib-uglify": "^0.6.0",
|
||||
"grunt-conventional-changelog": "^4.0.0",
|
||||
"grunt-conventional-github-releaser": "^0.3.0",
|
||||
"grunt-endline": "^0.4.0",
|
||||
"grunt-jscs": "^1.2.0",
|
||||
"grunt": "^1.0.1",
|
||||
"grunt-contrib-clean": "^1.0.0",
|
||||
"grunt-contrib-concat": "^1.0.1",
|
||||
"grunt-contrib-jshint": "^1.1.0",
|
||||
"grunt-contrib-uglify": "^2.0.0",
|
||||
"grunt-conventional-changelog": "^6.1.0",
|
||||
"grunt-conventional-github-releaser": "^1.0.0",
|
||||
"grunt-endline": "^0.6.1",
|
||||
"grunt-eslint": "^19.0.0",
|
||||
"grunt-simple-mocha": "^0.4.0",
|
||||
"js-beautify": "^1.5.6",
|
||||
"load-grunt-tasks": "^3.2.0",
|
||||
"performance-now": "^0.2.0",
|
||||
"performance-now": "^2.0.0",
|
||||
"quiet-grunt": "^0.2.3",
|
||||
"semver": "^5.0.0",
|
||||
"semver-sort": "0.0.4",
|
||||
"sinon": "^1.14.1",
|
||||
"source-map-support": "^0.2.9"
|
||||
"source-map-support": "^0.4.11"
|
||||
},
|
||||
"dependencies": {
|
||||
"yargs": "^6.6.0"
|
||||
|
File diff suppressed because one or more lines are too long
@ -6,40 +6,40 @@
|
||||
### Test Suite: Basic (50 cycles)
|
||||
| test | avgTime | max | min |
|
||||
|:-----|--------:|----:|----:|
|
||||
|Simple "Hello World"|0.366|6.060|0.165|
|
||||
|performance.testfile.md|26.820|47.685|24.495|
|
||||
|Simple "Hello World"|0.388|6.064|0.174|
|
||||
|performance.testfile.md|26.899|49.063|24.845|
|
||||
|
||||
### Test Suite: subParsers (20 cycles)
|
||||
| test | avgTime | max | min |
|
||||
|:-----|--------:|----:|----:|
|
||||
|hashHTMLBlocks|2.660|9.402|1.874|
|
||||
|anchors|0.502|3.829|0.256|
|
||||
|autoLinks|0.097|0.244|0.073|
|
||||
|blockQuotes|3.239|6.987|2.821|
|
||||
|codeBlocks|0.195|0.382|0.174|
|
||||
|codeSpans|0.267|0.814|0.157|
|
||||
|detab|0.102|0.176|0.087|
|
||||
|encodeAmpsAndAngles|0.042|0.070|0.038|
|
||||
|encodeBackslashEscapes|0.076|0.125|0.068|
|
||||
|encodeCode|0.919|1.457|0.823|
|
||||
|escapeSpecialCharsWithinTagAttributes|0.276|0.638|0.242|
|
||||
|githubCodeBlocks|0.189|0.821|0.137|
|
||||
|hashBlock|0.119|1.526|0.036|
|
||||
|hashElement|0.002|0.032|0.000|
|
||||
|hashHTMLSpans|0.341|1.617|0.238|
|
||||
|hashPreCodeTags|0.139|0.299|0.109|
|
||||
|headers|0.955|2.204|0.803|
|
||||
|horizontalRule|0.216|0.331|0.194|
|
||||
|images|0.081|0.165|0.073|
|
||||
|italicsAndBold|0.254|0.438|0.210|
|
||||
|lists|5.076|5.787|4.679|
|
||||
|outdent|0.157|0.255|0.142|
|
||||
|paragraphs|4.067|5.360|3.584|
|
||||
|spanGamut|1.524|2.136|1.321|
|
||||
|strikethrough|0.005|0.093|0.000|
|
||||
|stripLinkDefinitions|0.160|0.229|0.143|
|
||||
|tables|0.002|0.038|0.000|
|
||||
|unescapeSpecialChars|0.009|0.050|0.006|
|
||||
|hashHTMLBlocks|2.616|8.181|1.899|
|
||||
|anchors|0.515|4.691|0.264|
|
||||
|autoLinks|0.093|0.188|0.073|
|
||||
|blockQuotes|4.518|8.953|3.036|
|
||||
|codeBlocks|0.223|0.348|0.188|
|
||||
|codeSpans|0.318|1.095|0.177|
|
||||
|detab|0.092|0.137|0.087|
|
||||
|encodeAmpsAndAngles|0.044|0.089|0.038|
|
||||
|encodeBackslashEscapes|0.108|0.265|0.078|
|
||||
|encodeCode|1.535|9.896|0.865|
|
||||
|escapeSpecialCharsWithinTagAttributes|0.294|0.523|0.253|
|
||||
|githubCodeBlocks|0.208|0.790|0.142|
|
||||
|hashBlock|0.042|0.123|0.036|
|
||||
|hashElement|0.002|0.029|0.000|
|
||||
|hashHTMLSpans|0.410|1.598|0.240|
|
||||
|hashPreCodeTags|0.132|0.395|0.110|
|
||||
|headers|1.015|1.502|0.806|
|
||||
|horizontalRule|0.220|0.357|0.195|
|
||||
|images|0.158|0.978|0.077|
|
||||
|italicsAndBold|0.288|0.639|0.241|
|
||||
|lists|5.151|6.331|4.629|
|
||||
|outdent|0.180|0.363|0.143|
|
||||
|paragraphs|4.548|6.309|4.002|
|
||||
|spanGamut|1.519|1.864|1.372|
|
||||
|strikethrough|0.003|0.065|0.000|
|
||||
|stripLinkDefinitions|0.179|0.313|0.144|
|
||||
|tables|0.004|0.063|0.000|
|
||||
|unescapeSpecialChars|0.011|0.049|0.007|
|
||||
|
||||
|
||||
## [version 1.6.2](https://github.com/showdownjs/showdown/tree/1.6.2)
|
||||
|
@ -32,6 +32,7 @@ yargs
|
||||
|
||||
var argv = yargs.argv,
|
||||
command = argv._[0];
|
||||
|
||||
if (command === 'makehtml') {
|
||||
require('./makehtml.cmd.js').run();
|
||||
} else {
|
||||
|
@ -324,7 +324,7 @@ function validate(extension, name) {
|
||||
if (showdown.helper.isString(ext.regex)) {
|
||||
ext.regex = new RegExp(ext.regex, 'g');
|
||||
}
|
||||
if (!ext.regex instanceof RegExp) {
|
||||
if (!(ext.regex instanceof RegExp)) {
|
||||
ret.valid = false;
|
||||
ret.error = baseMsg + '"regex" property must either be a string or a RegExp object, but ' + typeof ext.regex + ' given';
|
||||
return ret;
|
||||
|
@ -10,7 +10,7 @@ showdown.subParser('runExtension', function (ext, text, options, globals) {
|
||||
} else if (ext.regex) {
|
||||
// TODO remove this when old extension loading mechanism is deprecated
|
||||
var re = ext.regex;
|
||||
if (!re instanceof RegExp) {
|
||||
if (!(re instanceof RegExp)) {
|
||||
re = new RegExp(re, 'g');
|
||||
}
|
||||
text = text.replace(re, ext.replace);
|
||||
|
@ -11,6 +11,7 @@ describe('showdown.Converter', function () {
|
||||
var showdown = require('../bootstrap').showdown;
|
||||
|
||||
describe('Converter.options extensions', function () {
|
||||
var runCount;
|
||||
showdown.extensions.testext = function () {
|
||||
return [{
|
||||
type: 'output',
|
||||
@ -20,8 +21,8 @@ describe('showdown.Converter', function () {
|
||||
}
|
||||
}];
|
||||
};
|
||||
var runCount,
|
||||
converter = new showdown.Converter({extensions: ['testext']});
|
||||
|
||||
var converter = new showdown.Converter({extensions: ['testext']});
|
||||
|
||||
it('output extensions should run once', function () {
|
||||
runCount = 0;
|
||||
|
@ -39,8 +39,7 @@ performance.generateLog = function (filename, MDFilename, asTable) {
|
||||
|
||||
try {
|
||||
jsonParsed = JSON.parse(json);
|
||||
}
|
||||
catch (err) {
|
||||
} catch (err) {
|
||||
jsonParsed = {};
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user