diff --git a/.eslintrc.json b/.eslintrc.json
new file mode 100644
index 0000000..2afad32
--- /dev/null
+++ b/.eslintrc.json
@@ -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
+ }
+}
diff --git a/.gitattributes b/.gitattributes
index 576bdfd..b26c13c 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -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
diff --git a/.jscs.json b/.jscs.json
deleted file mode 100644
index 23a8a1d..0000000
--- a/.jscs.json
+++ /dev/null
@@ -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
-}
diff --git a/.travis.yml b/.travis.yml
index 1e2c763..9349e95 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -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:
diff --git a/Gruntfile.js b/Gruntfile.js
index 1d7af11..d9377b5 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -73,17 +73,15 @@ module.exports = function (grunt) {
]
},
- jscs: {
+ eslint: {
options: {
- config: '.jscs.json'
+ config: '.eslintrc.json'
},
- files: {
- src: [
- 'Gruntfile.js',
- 'src/**/*.js',
- 'test/**/*.js'
- ]
- }
+ 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']);
diff --git a/README.md b/README.md
index 0ba88d5..43d80dc 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
![Showdown][sd-logo]
-[![Build Status](https://travis-ci.org/showdownjs/showdown.svg?branch=master)](https://travis-ci.org/showdownjs/showdown) [![npm version](https://badge.fury.io/js/showdown.svg)](http://badge.fury.io/js/showdown) [![Bower version](https://badge.fury.io/bo/showdown.svg)](http://badge.fury.io/bo/showdown) [![Join the chat at https://gitter.im/showdownjs/showdown](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/showdownjs/showdown?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
+[![Build Status](https://travis-ci.org/showdownjs/showdown.svg?branch=master)](https://travis-ci.org/showdownjs/showdown) [![npm version](https://badge.fury.io/js/showdown.svg)](http://badge.fury.io/js/showdown) [![Bower version](https://badge.fury.io/bo/showdown.svg)](http://badge.fury.io/bo/showdown) [![Join the chat at https://gitter.im/showdownjs/showdown](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/showdownjs/showdown?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Greenkeeper badge](https://badges.greenkeeper.io/showdownjs/showdown.svg)](https://greenkeeper.io/)
------
diff --git a/dist/showdown.js b/dist/showdown.js
index 38ae9fd..4d07b81 100644
Binary files a/dist/showdown.js and b/dist/showdown.js differ
diff --git a/dist/showdown.js.map b/dist/showdown.js.map
index 4b29800..ab71a86 100644
Binary files a/dist/showdown.js.map and b/dist/showdown.js.map differ
diff --git a/dist/showdown.min.js b/dist/showdown.min.js
index ffd42db..590be1c 100644
Binary files a/dist/showdown.min.js and b/dist/showdown.min.js differ
diff --git a/dist/showdown.min.js.map b/dist/showdown.min.js.map
index 34244ed..b16cbf9 100644
Binary files a/dist/showdown.min.js.map and b/dist/showdown.min.js.map differ
diff --git a/package.json b/package.json
index 40b5596..6f3b75b 100644
--- a/package.json
+++ b/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"
diff --git a/performance.json b/performance.json
index 2300d51..6ea906f 100644
--- a/performance.json
+++ b/performance.json
@@ -1 +1 @@
-{"1.6.3":[{"suiteName":"Basic","cycles":50,"tests":[{"name":"Simple \"Hello World\"","time":0.3664977799999998,"maxTime":6.059578,"minTime":0.16514000000000095},{"name":"performance.testfile.md","time":26.820436279999996,"maxTime":47.685272999999995,"minTime":24.495364999999993}]},{"suiteName":"subParsers","cycles":20,"tests":[{"name":"hashHTMLBlocks","time":2.6604824499999835,"maxTime":9.402169999999842,"minTime":1.8741050000000996},{"name":"anchors","time":0.5020216500000061,"maxTime":3.828672000000097,"minTime":0.2564500000000862},{"name":"autoLinks","time":0.09727624999999307,"maxTime":0.24409500000001572,"minTime":0.07292699999993602},{"name":"blockQuotes","time":3.2392283499999963,"maxTime":6.987137999999959,"minTime":2.820953000000145},{"name":"codeBlocks","time":0.1953511500000218,"maxTime":0.38181200000008175,"minTime":0.17357799999990675},{"name":"codeSpans","time":0.2671484000000078,"maxTime":0.8139510000000882,"minTime":0.15730599999983497},{"name":"detab","time":0.10187189999999191,"maxTime":0.17568800000003648,"minTime":0.08678999999983716},{"name":"encodeAmpsAndAngles","time":0.041707249999990384,"maxTime":0.07021499999996195,"minTime":0.03827099999989514},{"name":"encodeBackslashEscapes","time":0.07603105000000596,"maxTime":0.12506099999995968,"minTime":0.06780399999979636},{"name":"encodeCode","time":0.9185499000000164,"maxTime":1.4573370000000523,"minTime":0.8229910000000018},{"name":"escapeSpecialCharsWithinTagAttributes","time":0.27606825000001434,"maxTime":0.6376599999998689,"minTime":0.2416840000000775},{"name":"githubCodeBlocks","time":0.18906785000000353,"maxTime":0.8208819999999832,"minTime":0.13681300000007468},{"name":"hashBlock","time":0.11855175000000599,"maxTime":1.5263459999998759,"minTime":0.036162000000103944},{"name":"hashElement","time":0.0018382999999971617,"maxTime":0.03164199999991979,"minTime":0},{"name":"hashHTMLSpans","time":0.34138615000002803,"maxTime":1.616751000000022,"minTime":0.23776600000019243},{"name":"hashPreCodeTags","time":0.1390285499999891,"maxTime":0.2989399999999023,"minTime":0.1087880000000041},{"name":"headers","time":0.9550434999999766,"maxTime":2.204386999999997,"minTime":0.8028009999998176},{"name":"horizontalRule","time":0.2161594499999751,"maxTime":0.33058299999993324,"minTime":0.19376899999997477},{"name":"images","time":0.08106340000001637,"maxTime":0.16544199999998455,"minTime":0.07262500000001637},{"name":"italicsAndBold","time":0.2539941500000168,"maxTime":0.43816500000002634,"minTime":0.20974099999989448},{"name":"lists","time":5.076132100000029,"maxTime":5.78685500000006,"minTime":4.678785000000062},{"name":"outdent","time":0.156582249999974,"maxTime":0.2549439999997958,"minTime":0.14223800000013398},{"name":"paragraphs","time":4.06708630000004,"maxTime":5.360442000000148,"minTime":3.584274999999934},{"name":"spanGamut","time":1.5240706000000046,"maxTime":2.1362810000000536,"minTime":1.3208240000001297},{"name":"strikethrough","time":0.004851700000006076,"maxTime":0.09311699999989287,"minTime":0},{"name":"stripLinkDefinitions","time":0.1599873000000116,"maxTime":0.22872499999994034,"minTime":0.1434430000001612},{"name":"tables","time":0.0022450000000276303,"maxTime":0.03827100000012251,"minTime":0},{"name":"unescapeSpecialChars","time":0.009387000000003809,"maxTime":0.04972300000008545,"minTime":0.006328000000166867}]}],"1.6.2":[{"suiteName":"Basic","cycles":50,"tests":[{"name":"Simple \"Hello World\"","time":0.6130621400000001,"maxTime":5.893518999999998,"minTime":0.16875699999999938},{"name":"performance.testfile.md","time":25.970254839999992,"maxTime":62.88168,"minTime":23.709682999999927}]},{"suiteName":"subParsers","cycles":20,"tests":[{"name":"hashHTMLBlocks","time":2.6685977000000323,"maxTime":8.478507000000036,"minTime":1.8846490000000813},{"name":"anchors","time":0.5002727000000278,"maxTime":3.841318999999885,"minTime":0.2676000000001295},{"name":"autoLinks","time":0.09846654999997781,"maxTime":0.21064500000011321,"minTime":0.07202299999994466},{"name":"blockQuotes","time":3.221817550000014,"maxTime":5.825714999999946,"minTime":2.791112000000112},{"name":"codeBlocks","time":0.17663659999998343,"maxTime":0.3712639999998828,"minTime":0.1570040000001427},{"name":"codeSpans","time":0.2181328999999778,"maxTime":0.483066000000008,"minTime":0.15097700000001169},{"name":"detab","time":0.13492999999998573,"maxTime":0.6545340000000124,"minTime":0.08498099999997066},{"name":"encodeAmpsAndAngles","time":0.04158639999994875,"maxTime":0.11752699999988181,"minTime":0.03616199999987657},{"name":"encodeBackslashEscapes","time":0.0800689000000034,"maxTime":0.13319799999999304,"minTime":0.06780399999979636},{"name":"encodeCode","time":0.5599700499999927,"maxTime":0.9821019999999407,"minTime":0.48396900000011556},{"name":"escapeSpecialCharsWithinTagAttributes","time":0.35280645000001415,"maxTime":0.5683480000000145,"minTime":0.2914060000000518},{"name":"githubCodeBlocks","time":0.17996669999999995,"maxTime":0.7729650000001129,"minTime":0.1274710000000141},{"name":"hashBlock","time":0.057723849999990764,"maxTime":0.31159699999989243,"minTime":0.037368000000014945},{"name":"hashElement","time":0.0025463500000000748,"maxTime":0.04610600000000886,"minTime":0},{"name":"hashHTMLSpans","time":0.47458235000001425,"maxTime":2.325223000000051,"minTime":0.2344510000000355},{"name":"hashPreCodeTags","time":0.12186629999998785,"maxTime":0.3073779999999715,"minTime":0.10697999999979402},{"name":"headers","time":0.8577350000000024,"maxTime":0.9540770000000975,"minTime":0.7801970000000438},{"name":"horizontalRule","time":0.22663095000001476,"maxTime":0.41797300000007453,"minTime":0.1967819999999847},{"name":"images","time":0.17053435000000264,"maxTime":1.4528119999999944,"minTime":0.07714599999985694},{"name":"italicsAndBold","time":0.10093754999998054,"maxTime":0.20220699999981662,"minTime":0.0882960000001276},{"name":"lists","time":4.9306124000000064,"maxTime":5.460477999999966,"minTime":4.55642499999999},{"name":"outdent","time":0.16260889999998654,"maxTime":0.31461000000012973,"minTime":0.1416349999999511},{"name":"paragraphs","time":3.7896679000000177,"maxTime":5.563840999999911,"minTime":3.278396000000157},{"name":"spanGamut","time":1.4417527499999891,"maxTime":2.0124210000001312,"minTime":1.2032939999999144},{"name":"strikethrough","time":0.004233999999985372,"maxTime":0.08196800000018811,"minTime":0},{"name":"stripBlankLines","time":0.08623144999999113,"maxTime":0.1304850000001352,"minTime":0.0804600000001301},{"name":"stripLinkDefinitions","time":0.15983660000002828,"maxTime":0.21727400000008856,"minTime":0.1446480000001884},{"name":"tables","time":0.004143600000008974,"maxTime":0.07593999999994594,"minTime":0},{"name":"unescapeSpecialChars","time":0.00991439999999102,"maxTime":0.0581609999999273,"minTime":0.006628999999975349}]}],"1.6.1":[{"suiteName":"Basic","cycles":50,"tests":[{"name":"Simple \"Hello World\"","time":0.3172682400000001,"maxTime":5.4981469999999995,"minTime":0.16062000000000154},{"name":"readme.md","time":26.0144148,"maxTime":46.79858399999999,"minTime":24.245484999999917}]},{"suiteName":"subParsers","cycles":20,"tests":[{"name":"hashHTMLBlocks","time":2.6414157500000215,"maxTime":7.791727999999921,"minTime":1.9364810000001853},{"name":"anchors","time":0.47462755000000245,"maxTime":4.062812000000122,"minTime":0.25885999999991327},{"name":"autoLinks","time":0.08906409999998459,"maxTime":0.19708299999979317,"minTime":0.06870800000001509},{"name":"blockQuotes","time":3.213485000000014,"maxTime":6.05383699999993,"minTime":2.880010000000084},{"name":"codeBlocks","time":0.16200620000001892,"maxTime":0.2691060000001926,"minTime":0.15308599999980288},{"name":"codeSpans","time":0.169494799999984,"maxTime":0.39868699999988166,"minTime":0.1410319999999956},{"name":"detab","time":0.12471390000000611,"maxTime":0.6647800000000643,"minTime":0.08558400000015354},{"name":"encodeAmpsAndAngles","time":0.04181244999999763,"maxTime":0.08920000000011896,"minTime":0.03796999999985928},{"name":"encodeBackslashEscapes","time":0.07586505000000443,"maxTime":0.13289599999984603,"minTime":0.06810500000005959},{"name":"encodeCode","time":0.5765897500000051,"maxTime":0.970348999999942,"minTime":0.4791480000001229},{"name":"escapeSpecialCharsWithinTagAttributes","time":0.24603789999998754,"maxTime":0.35047099999997045,"minTime":0.22119199999997363},{"name":"githubCodeBlocks","time":0.1767573999999968,"maxTime":0.815454999999929,"minTime":0.1250600000000759},{"name":"hashBlock","time":0.06537804999999253,"maxTime":0.42972599999984595,"minTime":0.0376690000000508},{"name":"hashElement","time":0.0020039500000052614,"maxTime":0.034051999999974214,"minTime":0},{"name":"hashHTMLSpans","time":0.42437735000000887,"maxTime":2.3210050000000138,"minTime":0.24078000000008615},{"name":"hashPreCodeTags","time":0.12225794999998243,"maxTime":0.23836899999992056,"minTime":0.10396600000012768},{"name":"headers","time":0.8037480999999957,"maxTime":0.9462419999999838,"minTime":0.7256529999999657},{"name":"horizontalRule","time":0.2186149999999884,"maxTime":0.27362700000003315,"minTime":0.19437100000004648},{"name":"images","time":0.12388539999997192,"maxTime":0.9019430000000739,"minTime":0.07081799999991745},{"name":"italicsAndBold","time":0.10089220000002115,"maxTime":0.15037400000005618,"minTime":0.08950099999992744},{"name":"lists","time":4.938929699999983,"maxTime":5.421000999999933,"minTime":4.623625999999831},{"name":"outdent","time":0.1648239000000217,"maxTime":0.3372110000000248,"minTime":0.1404290000000401},{"name":"paragraphs","time":3.4947812,"maxTime":4.554917999999816,"minTime":3.1714170000000195},{"name":"spanGamut","time":1.318997649999983,"maxTime":1.9916279999999915,"minTime":1.1469409999999698},{"name":"strikethrough","time":0.007458499999995638,"maxTime":0.14314200000012534,"minTime":0},{"name":"stripBlankLines","time":0.09447364999999763,"maxTime":0.1545929999999771,"minTime":0.0822689999999966},{"name":"stripLinkDefinitions","time":0.1762751000000094,"maxTime":0.3112949999999728,"minTime":0.1464570000000549},{"name":"tables","time":0.0023505499999828317,"maxTime":0.03947699999980614,"minTime":0},{"name":"unescapeSpecialChars","time":0.008332400000006146,"maxTime":0.03375200000004952,"minTime":0.0066299999998591375}]}],"1.6.0":[{"suiteName":"Basic","cycles":50,"tests":[{"name":"Simple \"Hello World\"","time":0.3075345600000001,"maxTime":5.369168,"minTime":0.1570040000000006},{"name":"readme.md","time":25.81825956,"maxTime":47.795452,"minTime":23.775378000000046}]},{"suiteName":"subParsers","cycles":20,"tests":[{"name":"hashHTMLBlocks","time":2.652987649999966,"maxTime":8.557761999999911,"minTime":1.8804290000000492},{"name":"anchors","time":0.5166509500000303,"maxTime":4.142066999999997,"minTime":0.27121600000009494},{"name":"autoLinks","time":0.0885518999999931,"maxTime":0.19437100000004648,"minTime":0.0705159999999978},{"name":"blockGamut","time":17.371581599999978,"maxTime":22.94093699999985,"minTime":14.081522999999834},{"name":"blockQuotes","time":3.011308699999995,"maxTime":4.110426000000189,"minTime":2.7742359999999735},{"name":"codeBlocks","time":0.24291900000000624,"maxTime":0.8344409999999698,"minTime":0.19346700000005512},{"name":"codeSpans","time":0.2271433000000002,"maxTime":0.4583549999999832,"minTime":0.19135800000003655},{"name":"detab","time":0.09469964999999547,"maxTime":0.13289599999984603,"minTime":0.08950099999992744},{"name":"encodeAmpsAndAngles","time":0.040486450000014426,"maxTime":0.07262600000012753,"minTime":0.03766799999993964},{"name":"encodeBackslashEscapes","time":0.09959649999997282,"maxTime":0.5095850000000155,"minTime":0.06840699999997923},{"name":"encodeCode","time":0.5320952499999863,"maxTime":0.7057630000001609,"minTime":0.4794489999999314},{"name":"escapeSpecialCharsWithinTagAttributes","time":0.38607564999999794,"maxTime":0.7018459999999322,"minTime":0.326663999999937},{"name":"githubCodeBlocks","time":0.21441115000002356,"maxTime":0.7780880000000252,"minTime":0.15579800000000432},{"name":"hashBlock","time":0.056638900000007195,"maxTime":0.27995499999997264,"minTime":0.035257999999885214},{"name":"hashElement","time":0.001958799999999883,"maxTime":0.033148999999866646,"minTime":0},{"name":"hashHTMLSpans","time":0.38414695000003574,"maxTime":1.9973540000000867,"minTime":0.2356569999999465},{"name":"hashPreCodeTags","time":0.1327451500000393,"maxTime":0.20009700000014163,"minTime":0.1157189999998991},{"name":"headers","time":0.9440720999999825,"maxTime":2.4683650000001762,"minTime":0.7823069999999461},{"name":"images","time":0.12035954999996648,"maxTime":0.4857769999998709,"minTime":0.08588499999996202},{"name":"italicsAndBold","time":0.11076150000000098,"maxTime":0.4447930000001179,"minTime":0.08799499999986438},{"name":"lists","time":5.782546349999995,"maxTime":13.248890999999958,"minTime":4.463608999999906},{"name":"outdent","time":0.3057505000000219,"maxTime":0.9561860000001161,"minTime":0.22541000000001077},{"name":"paragraphs","time":6.582542549999971,"maxTime":8.810596000000032,"minTime":4.498867000000246},{"name":"spanGamut","time":2.43690389999997,"maxTime":3.067450000000008,"minTime":1.6474849999999606},{"name":"strikethrough","time":0.005228549999992537,"maxTime":0.10035000000016225,"minTime":0},{"name":"stripBlankLines","time":0.12142940000005638,"maxTime":0.17508399999996982,"minTime":0.09191199999986566},{"name":"stripLinkDefinitions","time":0.24673084999997172,"maxTime":0.572566000000279,"minTime":0.17146900000034293},{"name":"tables","time":0.005650249999962398,"maxTime":0.0985419999997248,"minTime":0.00030099999958110857},{"name":"unescapeSpecialChars","time":0.016694800000050237,"maxTime":0.06569400000034875,"minTime":0.011450999999851774}]}]}
\ No newline at end of file
+{"1.6.3":[{"suiteName":"Basic","cycles":50,"tests":[{"name":"Simple \"Hello World\"","time":0.3880986600000119,"maxTime":6.064399999999978,"minTime":0.17418099999997594},{"name":"performance.testfile.md","time":26.898552680000012,"maxTime":49.06275100000005,"minTime":24.84523399999989}]},{"suiteName":"subParsers","cycles":20,"tests":[{"name":"hashHTMLBlocks","time":2.6158222500000194,"maxTime":8.18079200000011,"minTime":1.8985149999998612},{"name":"anchors","time":0.5154769000000442,"maxTime":4.690839000000324,"minTime":0.2639840000001641},{"name":"autoLinks","time":0.09307249999999385,"maxTime":0.18834400000014284,"minTime":0.07262600000012753},{"name":"blockQuotes","time":4.5183903999999755,"maxTime":8.952854000000116,"minTime":3.035816000000068},{"name":"codeBlocks","time":0.22262349999998604,"maxTime":0.347758999999769,"minTime":0.18834500000002663},{"name":"codeSpans","time":0.31763950000004115,"maxTime":1.0948100000000522,"minTime":0.1771950000002107},{"name":"detab","time":0.0919273999999632,"maxTime":0.13651200000003882,"minTime":0.08739199999990888},{"name":"encodeAmpsAndAngles","time":0.0438916999999492,"maxTime":0.08919999999989159,"minTime":0.038271000000349886},{"name":"encodeBackslashEscapes","time":0.10785369999998692,"maxTime":0.2651890000001913,"minTime":0.07835100000011153},{"name":"encodeCode","time":1.5346329500000138,"maxTime":9.895783999999821,"minTime":0.8645779999997103},{"name":"escapeSpecialCharsWithinTagAttributes","time":0.2937122499999759,"maxTime":0.5234480000003714,"minTime":0.25343700000030367},{"name":"githubCodeBlocks","time":0.20775164999997742,"maxTime":0.7901440000000548,"minTime":0.1416349999999511},{"name":"hashBlock","time":0.042234400000006646,"maxTime":0.12325299999974959,"minTime":0.035860999999840715},{"name":"hashElement","time":0.0016724999999951252,"maxTime":0.028929000000061933,"minTime":0},{"name":"hashHTMLSpans","time":0.4103353000000197,"maxTime":1.5980680000002394,"minTime":0.2404790000000503},{"name":"hashPreCodeTags","time":0.13196184999997057,"maxTime":0.3950719999998,"minTime":0.11029400000006717},{"name":"headers","time":1.0150126000000683,"maxTime":1.501936999999998,"minTime":0.8055130000002464},{"name":"horizontalRule","time":0.22018260000002102,"maxTime":0.35710100000005696,"minTime":0.1946739999998499},{"name":"images","time":0.1582398000000012,"maxTime":0.978186999999707,"minTime":0.07684500000004846},{"name":"italicsAndBold","time":0.28757974999998626,"maxTime":0.6394679999998516,"minTime":0.24078000000008615},{"name":"lists","time":5.151319100000023,"maxTime":6.331397000000379,"minTime":4.629061999999976},{"name":"outdent","time":0.18019314999994548,"maxTime":0.36342999999988024,"minTime":0.14253999999982625},{"name":"paragraphs","time":4.547636500000022,"maxTime":6.308794999999918,"minTime":4.002250999999887},{"name":"spanGamut","time":1.5190982500000245,"maxTime":1.863557999999557,"minTime":1.3720530000000508},{"name":"strikethrough","time":0.003450399999996989,"maxTime":0.06539299999985815,"minTime":0},{"name":"stripLinkDefinitions","time":0.1786111499999606,"maxTime":0.3128030000002582,"minTime":0.1443480000002637},{"name":"tables","time":0.0035106999999925392,"maxTime":0.06268099999988408,"minTime":0.00030099999958110857},{"name":"unescapeSpecialChars","time":0.01146649999998317,"maxTime":0.04881900000009409,"minTime":0.006628999999975349}]}],"1.6.2":[{"suiteName":"Basic","cycles":50,"tests":[{"name":"Simple \"Hello World\"","time":0.6130621400000001,"maxTime":5.893518999999998,"minTime":0.16875699999999938},{"name":"performance.testfile.md","time":25.970254839999992,"maxTime":62.88168,"minTime":23.709682999999927}]},{"suiteName":"subParsers","cycles":20,"tests":[{"name":"hashHTMLBlocks","time":2.6685977000000323,"maxTime":8.478507000000036,"minTime":1.8846490000000813},{"name":"anchors","time":0.5002727000000278,"maxTime":3.841318999999885,"minTime":0.2676000000001295},{"name":"autoLinks","time":0.09846654999997781,"maxTime":0.21064500000011321,"minTime":0.07202299999994466},{"name":"blockQuotes","time":3.221817550000014,"maxTime":5.825714999999946,"minTime":2.791112000000112},{"name":"codeBlocks","time":0.17663659999998343,"maxTime":0.3712639999998828,"minTime":0.1570040000001427},{"name":"codeSpans","time":0.2181328999999778,"maxTime":0.483066000000008,"minTime":0.15097700000001169},{"name":"detab","time":0.13492999999998573,"maxTime":0.6545340000000124,"minTime":0.08498099999997066},{"name":"encodeAmpsAndAngles","time":0.04158639999994875,"maxTime":0.11752699999988181,"minTime":0.03616199999987657},{"name":"encodeBackslashEscapes","time":0.0800689000000034,"maxTime":0.13319799999999304,"minTime":0.06780399999979636},{"name":"encodeCode","time":0.5599700499999927,"maxTime":0.9821019999999407,"minTime":0.48396900000011556},{"name":"escapeSpecialCharsWithinTagAttributes","time":0.35280645000001415,"maxTime":0.5683480000000145,"minTime":0.2914060000000518},{"name":"githubCodeBlocks","time":0.17996669999999995,"maxTime":0.7729650000001129,"minTime":0.1274710000000141},{"name":"hashBlock","time":0.057723849999990764,"maxTime":0.31159699999989243,"minTime":0.037368000000014945},{"name":"hashElement","time":0.0025463500000000748,"maxTime":0.04610600000000886,"minTime":0},{"name":"hashHTMLSpans","time":0.47458235000001425,"maxTime":2.325223000000051,"minTime":0.2344510000000355},{"name":"hashPreCodeTags","time":0.12186629999998785,"maxTime":0.3073779999999715,"minTime":0.10697999999979402},{"name":"headers","time":0.8577350000000024,"maxTime":0.9540770000000975,"minTime":0.7801970000000438},{"name":"horizontalRule","time":0.22663095000001476,"maxTime":0.41797300000007453,"minTime":0.1967819999999847},{"name":"images","time":0.17053435000000264,"maxTime":1.4528119999999944,"minTime":0.07714599999985694},{"name":"italicsAndBold","time":0.10093754999998054,"maxTime":0.20220699999981662,"minTime":0.0882960000001276},{"name":"lists","time":4.9306124000000064,"maxTime":5.460477999999966,"minTime":4.55642499999999},{"name":"outdent","time":0.16260889999998654,"maxTime":0.31461000000012973,"minTime":0.1416349999999511},{"name":"paragraphs","time":3.7896679000000177,"maxTime":5.563840999999911,"minTime":3.278396000000157},{"name":"spanGamut","time":1.4417527499999891,"maxTime":2.0124210000001312,"minTime":1.2032939999999144},{"name":"strikethrough","time":0.004233999999985372,"maxTime":0.08196800000018811,"minTime":0},{"name":"stripBlankLines","time":0.08623144999999113,"maxTime":0.1304850000001352,"minTime":0.0804600000001301},{"name":"stripLinkDefinitions","time":0.15983660000002828,"maxTime":0.21727400000008856,"minTime":0.1446480000001884},{"name":"tables","time":0.004143600000008974,"maxTime":0.07593999999994594,"minTime":0},{"name":"unescapeSpecialChars","time":0.00991439999999102,"maxTime":0.0581609999999273,"minTime":0.006628999999975349}]}],"1.6.1":[{"suiteName":"Basic","cycles":50,"tests":[{"name":"Simple \"Hello World\"","time":0.3172682400000001,"maxTime":5.4981469999999995,"minTime":0.16062000000000154},{"name":"readme.md","time":26.0144148,"maxTime":46.79858399999999,"minTime":24.245484999999917}]},{"suiteName":"subParsers","cycles":20,"tests":[{"name":"hashHTMLBlocks","time":2.6414157500000215,"maxTime":7.791727999999921,"minTime":1.9364810000001853},{"name":"anchors","time":0.47462755000000245,"maxTime":4.062812000000122,"minTime":0.25885999999991327},{"name":"autoLinks","time":0.08906409999998459,"maxTime":0.19708299999979317,"minTime":0.06870800000001509},{"name":"blockQuotes","time":3.213485000000014,"maxTime":6.05383699999993,"minTime":2.880010000000084},{"name":"codeBlocks","time":0.16200620000001892,"maxTime":0.2691060000001926,"minTime":0.15308599999980288},{"name":"codeSpans","time":0.169494799999984,"maxTime":0.39868699999988166,"minTime":0.1410319999999956},{"name":"detab","time":0.12471390000000611,"maxTime":0.6647800000000643,"minTime":0.08558400000015354},{"name":"encodeAmpsAndAngles","time":0.04181244999999763,"maxTime":0.08920000000011896,"minTime":0.03796999999985928},{"name":"encodeBackslashEscapes","time":0.07586505000000443,"maxTime":0.13289599999984603,"minTime":0.06810500000005959},{"name":"encodeCode","time":0.5765897500000051,"maxTime":0.970348999999942,"minTime":0.4791480000001229},{"name":"escapeSpecialCharsWithinTagAttributes","time":0.24603789999998754,"maxTime":0.35047099999997045,"minTime":0.22119199999997363},{"name":"githubCodeBlocks","time":0.1767573999999968,"maxTime":0.815454999999929,"minTime":0.1250600000000759},{"name":"hashBlock","time":0.06537804999999253,"maxTime":0.42972599999984595,"minTime":0.0376690000000508},{"name":"hashElement","time":0.0020039500000052614,"maxTime":0.034051999999974214,"minTime":0},{"name":"hashHTMLSpans","time":0.42437735000000887,"maxTime":2.3210050000000138,"minTime":0.24078000000008615},{"name":"hashPreCodeTags","time":0.12225794999998243,"maxTime":0.23836899999992056,"minTime":0.10396600000012768},{"name":"headers","time":0.8037480999999957,"maxTime":0.9462419999999838,"minTime":0.7256529999999657},{"name":"horizontalRule","time":0.2186149999999884,"maxTime":0.27362700000003315,"minTime":0.19437100000004648},{"name":"images","time":0.12388539999997192,"maxTime":0.9019430000000739,"minTime":0.07081799999991745},{"name":"italicsAndBold","time":0.10089220000002115,"maxTime":0.15037400000005618,"minTime":0.08950099999992744},{"name":"lists","time":4.938929699999983,"maxTime":5.421000999999933,"minTime":4.623625999999831},{"name":"outdent","time":0.1648239000000217,"maxTime":0.3372110000000248,"minTime":0.1404290000000401},{"name":"paragraphs","time":3.4947812,"maxTime":4.554917999999816,"minTime":3.1714170000000195},{"name":"spanGamut","time":1.318997649999983,"maxTime":1.9916279999999915,"minTime":1.1469409999999698},{"name":"strikethrough","time":0.007458499999995638,"maxTime":0.14314200000012534,"minTime":0},{"name":"stripBlankLines","time":0.09447364999999763,"maxTime":0.1545929999999771,"minTime":0.0822689999999966},{"name":"stripLinkDefinitions","time":0.1762751000000094,"maxTime":0.3112949999999728,"minTime":0.1464570000000549},{"name":"tables","time":0.0023505499999828317,"maxTime":0.03947699999980614,"minTime":0},{"name":"unescapeSpecialChars","time":0.008332400000006146,"maxTime":0.03375200000004952,"minTime":0.0066299999998591375}]}],"1.6.0":[{"suiteName":"Basic","cycles":50,"tests":[{"name":"Simple \"Hello World\"","time":0.3075345600000001,"maxTime":5.369168,"minTime":0.1570040000000006},{"name":"readme.md","time":25.81825956,"maxTime":47.795452,"minTime":23.775378000000046}]},{"suiteName":"subParsers","cycles":20,"tests":[{"name":"hashHTMLBlocks","time":2.652987649999966,"maxTime":8.557761999999911,"minTime":1.8804290000000492},{"name":"anchors","time":0.5166509500000303,"maxTime":4.142066999999997,"minTime":0.27121600000009494},{"name":"autoLinks","time":0.0885518999999931,"maxTime":0.19437100000004648,"minTime":0.0705159999999978},{"name":"blockGamut","time":17.371581599999978,"maxTime":22.94093699999985,"minTime":14.081522999999834},{"name":"blockQuotes","time":3.011308699999995,"maxTime":4.110426000000189,"minTime":2.7742359999999735},{"name":"codeBlocks","time":0.24291900000000624,"maxTime":0.8344409999999698,"minTime":0.19346700000005512},{"name":"codeSpans","time":0.2271433000000002,"maxTime":0.4583549999999832,"minTime":0.19135800000003655},{"name":"detab","time":0.09469964999999547,"maxTime":0.13289599999984603,"minTime":0.08950099999992744},{"name":"encodeAmpsAndAngles","time":0.040486450000014426,"maxTime":0.07262600000012753,"minTime":0.03766799999993964},{"name":"encodeBackslashEscapes","time":0.09959649999997282,"maxTime":0.5095850000000155,"minTime":0.06840699999997923},{"name":"encodeCode","time":0.5320952499999863,"maxTime":0.7057630000001609,"minTime":0.4794489999999314},{"name":"escapeSpecialCharsWithinTagAttributes","time":0.38607564999999794,"maxTime":0.7018459999999322,"minTime":0.326663999999937},{"name":"githubCodeBlocks","time":0.21441115000002356,"maxTime":0.7780880000000252,"minTime":0.15579800000000432},{"name":"hashBlock","time":0.056638900000007195,"maxTime":0.27995499999997264,"minTime":0.035257999999885214},{"name":"hashElement","time":0.001958799999999883,"maxTime":0.033148999999866646,"minTime":0},{"name":"hashHTMLSpans","time":0.38414695000003574,"maxTime":1.9973540000000867,"minTime":0.2356569999999465},{"name":"hashPreCodeTags","time":0.1327451500000393,"maxTime":0.20009700000014163,"minTime":0.1157189999998991},{"name":"headers","time":0.9440720999999825,"maxTime":2.4683650000001762,"minTime":0.7823069999999461},{"name":"images","time":0.12035954999996648,"maxTime":0.4857769999998709,"minTime":0.08588499999996202},{"name":"italicsAndBold","time":0.11076150000000098,"maxTime":0.4447930000001179,"minTime":0.08799499999986438},{"name":"lists","time":5.782546349999995,"maxTime":13.248890999999958,"minTime":4.463608999999906},{"name":"outdent","time":0.3057505000000219,"maxTime":0.9561860000001161,"minTime":0.22541000000001077},{"name":"paragraphs","time":6.582542549999971,"maxTime":8.810596000000032,"minTime":4.498867000000246},{"name":"spanGamut","time":2.43690389999997,"maxTime":3.067450000000008,"minTime":1.6474849999999606},{"name":"strikethrough","time":0.005228549999992537,"maxTime":0.10035000000016225,"minTime":0},{"name":"stripBlankLines","time":0.12142940000005638,"maxTime":0.17508399999996982,"minTime":0.09191199999986566},{"name":"stripLinkDefinitions","time":0.24673084999997172,"maxTime":0.572566000000279,"minTime":0.17146900000034293},{"name":"tables","time":0.005650249999962398,"maxTime":0.0985419999997248,"minTime":0.00030099999958110857},{"name":"unescapeSpecialChars","time":0.016694800000050237,"maxTime":0.06569400000034875,"minTime":0.011450999999851774}]}]}
\ No newline at end of file
diff --git a/performance.log.md b/performance.log.md
index 85c0664..8fbc51c 100644
--- a/performance.log.md
+++ b/performance.log.md
@@ -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)
diff --git a/src/cli/cli.js b/src/cli/cli.js
index 2ed59ab..3080c77 100644
--- a/src/cli/cli.js
+++ b/src/cli/cli.js
@@ -31,7 +31,8 @@ yargs
.wrap(yargs.terminalWidth());
var argv = yargs.argv,
- command = argv._[0];
+ command = argv._[0];
+
if (command === 'makehtml') {
require('./makehtml.cmd.js').run();
} else {
diff --git a/src/cli/makehtml.cmd.js b/src/cli/makehtml.cmd.js
index 85b9492..eabc716 100644
--- a/src/cli/makehtml.cmd.js
+++ b/src/cli/makehtml.cmd.js
@@ -1,8 +1,8 @@
var yargs = require('yargs'),
- fs = require('fs'),
- Messenger = require('./messenger.js'),
- showdown = require('../../dist/showdown'),
- showdownOptions = showdown.getDefaultOptions(false);
+ fs = require('fs'),
+ Messenger = require('./messenger.js'),
+ showdown = require('../../dist/showdown'),
+ showdownOptions = showdown.getDefaultOptions(false);
yargs.reset()
.usage('Usage: showdown makehtml [options]')
@@ -72,7 +72,7 @@ for (var opt in showdownOptions) {
}
}
-function run() {
+function run () {
'use strict';
var argv = yargs.argv,
readMode = (!argv.i || argv.i === '') ? 'stdin' : 'file',
@@ -120,9 +120,9 @@ function run() {
write(html, append);
messenger.okExit();
- function parseOptions(flavor) {
+ function parseOptions (flavor) {
var options = {},
- flavorOpts = showdown.getFlavorOptions(flavor) || {};
+ flavorOpts = showdown.getFlavorOptions(flavor) || {};
// if flavor is not undefined, let's tell the user we're loading that preset
if (flavor) {
@@ -156,7 +156,7 @@ function run() {
return options;
}
- function readFromStdIn() {
+ function readFromStdIn () {
try {
var size = fs.fstatSync(process.stdin.fd).size;
return size > 0 ? fs.readSync(process.stdin.fd, size)[0] : '';
@@ -166,7 +166,7 @@ function run() {
}
}
- function readFromFile(encoding) {
+ function readFromFile (encoding) {
try {
return fs.readFileSync(argv.i, encoding);
} catch (err) {
@@ -174,11 +174,11 @@ function run() {
}
}
- function writeToStdOut(html) {
+ function writeToStdOut (html) {
return process.stdout.write(html);
}
- function writeToFile(html, append) {
+ function writeToFile (html, append) {
// If a flag is passed, it means we should append instead of overwriting.
// Only works with files, obviously
var write = (append) ? fs.appendFileSync : fs.writeFileSync;
diff --git a/src/cli/messenger.js b/src/cli/messenger.js
index fc3fe5a..906fb2e 100644
--- a/src/cli/messenger.js
+++ b/src/cli/messenger.js
@@ -1,4 +1,4 @@
-function Messenger(writeMode, supress, mute) {
+function Messenger (writeMode, supress, mute) {
'use strict';
writeMode = writeMode || 'stderr';
supress = (!!supress || !!mute);
diff --git a/src/converter.js b/src/converter.js
index 2a9c6ae..968679e 100644
--- a/src/converter.js
+++ b/src/converter.js
@@ -51,7 +51,7 @@ showdown.Converter = function (converterOptions) {
* Converter constructor
* @private
*/
- function _constructor() {
+ function _constructor () {
converterOptions = converterOptions || {};
for (var gOpt in globalOptions) {
@@ -83,7 +83,7 @@ showdown.Converter = function (converterOptions) {
* @param {string} [name='']
* @private
*/
- function _parseExtension(ext, name) {
+ function _parseExtension (ext, name) {
name = name || null;
// If it's a string, the extension was previously loaded
@@ -147,7 +147,7 @@ showdown.Converter = function (converterOptions) {
* @param {*} ext
* @param {string} name
*/
- function legacyExtensionLoading(ext, name) {
+ function legacyExtensionLoading (ext, name) {
if (typeof ext === 'function') {
ext = ext(new showdown.Converter());
}
@@ -179,7 +179,7 @@ showdown.Converter = function (converterOptions) {
* @param {string} name
* @param {function} callback
*/
- function listen(name, callback) {
+ function listen (name, callback) {
if (!showdown.helper.isString(name)) {
throw Error('Invalid argument in converter.listen() method: name must be a string, but ' + typeof name + ' given');
}
@@ -194,7 +194,7 @@ showdown.Converter = function (converterOptions) {
listeners[name].push(callback);
}
- function rTrimInputText(text) {
+ function rTrimInputText (text) {
var rsp = text.match(/^\s*/)[0].length,
rgx = new RegExp('^\\s{0,' + rsp + '}', 'gm');
return text.replace(rgx, '');
diff --git a/src/helpers.js b/src/helpers.js
index ff008c6..91a5d8f 100644
--- a/src/helpers.js
+++ b/src/helpers.js
@@ -101,7 +101,7 @@ showdown.helper.stdExtName = function (s) {
return s.replace(/[_?*+\/\\.^-]/g, '').replace(/\s/g, '').toLowerCase();
};
-function escapeCharactersCallback(wholeMatch, m1) {
+function escapeCharactersCallback (wholeMatch, m1) {
'use strict';
var charCodeToEscape = m1.charCodeAt(0);
return '¨E' + charCodeToEscape + 'E';
@@ -143,11 +143,11 @@ showdown.helper.escapeCharacters = function (text, charsToEscape, afterBackslash
var rgxFindMatchPos = function (str, left, right, flags) {
'use strict';
var f = flags || '',
- g = f.indexOf('g') > -1,
- x = new RegExp(left + '|' + right, 'g' + f.replace(/g/g, '')),
- l = new RegExp(left, f.replace(/g/g, '')),
- pos = [],
- t, s, m, start, end;
+ g = f.indexOf('g') > -1,
+ x = new RegExp(left + '|' + right, 'g' + f.replace(/g/g, '')),
+ l = new RegExp(left, f.replace(/g/g, '')),
+ pos = [],
+ t, s, m, start, end;
do {
t = 0;
@@ -211,7 +211,7 @@ showdown.helper.matchRecursiveRegExp = function (str, left, right, flags) {
'use strict';
var matchPos = rgxFindMatchPos (str, left, right, flags),
- results = [];
+ results = [];
for (var i = 0; i < matchPos.length; ++i) {
results.push([
diff --git a/src/options.js b/src/options.js
index 828b6db..abe254a 100644
--- a/src/options.js
+++ b/src/options.js
@@ -2,7 +2,7 @@
* Created by Tivie on 13-07-2015.
*/
-function getDefaultOpts(simple) {
+function getDefaultOpts (simple) {
'use strict';
var defaultOptions = {
@@ -129,7 +129,7 @@ function getDefaultOpts(simple) {
return ret;
}
-function allOptionsOn() {
+function allOptionsOn () {
'use strict';
var options = getDefaultOpts(true),
ret = {};
diff --git a/src/showdown.js b/src/showdown.js
index 9d760a5..28c77bb 100644
--- a/src/showdown.js
+++ b/src/showdown.js
@@ -237,14 +237,14 @@ showdown.resetExtensions = function () {
* @param {string} name
* @returns {{valid: boolean, error: string}}
*/
-function validate(extension, name) {
+function validate (extension, name) {
'use strict';
var errMsg = (name) ? 'Error in ' + name + ' extension->' : 'Error in unnamed extension',
- ret = {
- valid: true,
- error: ''
- };
+ ret = {
+ valid: true,
+ error: ''
+ };
if (!showdown.helper.isArray(extension)) {
extension = [extension];
@@ -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;
diff --git a/src/subParsers/autoLinks.js b/src/subParsers/autoLinks.js
index 4c89f3a..4f92793 100644
--- a/src/subParsers/autoLinks.js
+++ b/src/subParsers/autoLinks.js
@@ -23,7 +23,7 @@ showdown.subParser('autoLinks', function (text, options, globals) {
text = text.replace(simpleMailRegex, replaceMail);
}
- function replaceLink(wm, link, m2, m3, trailingPunctuation) {
+ function replaceLink (wm, link, m2, m3, trailingPunctuation) {
var lnkTxt = link,
append = '';
if (/^www\./i.test(link)) {
@@ -35,7 +35,7 @@ showdown.subParser('autoLinks', function (text, options, globals) {
return '' + lnkTxt + '' + append;
}
- function replaceMail(wholeMatch, b, mail) {
+ function replaceMail (wholeMatch, b, mail) {
var href = 'mailto:';
b = b || '';
mail = showdown.subParser('unescapeSpecialChars')(mail, options, globals);
diff --git a/src/subParsers/hashHTMLBlocks.js b/src/subParsers/hashHTMLBlocks.js
index 0787f0a..e4dd470 100644
--- a/src/subParsers/hashHTMLBlocks.js
+++ b/src/subParsers/hashHTMLBlocks.js
@@ -3,50 +3,50 @@ showdown.subParser('hashHTMLBlocks', function (text, options, globals) {
text = globals.converter._dispatch('hashHTMLBlocks.before', text, options, globals);
var blockTags = [
- 'pre',
- 'div',
- 'h1',
- 'h2',
- 'h3',
- 'h4',
- 'h5',
- 'h6',
- 'blockquote',
- 'table',
- 'dl',
- 'ol',
- 'ul',
- 'script',
- 'noscript',
- 'form',
- 'fieldset',
- 'iframe',
- 'math',
- 'style',
- 'section',
- 'header',
- 'footer',
- 'nav',
- 'article',
- 'aside',
- 'address',
- 'audio',
- 'canvas',
- 'figure',
- 'hgroup',
- 'output',
- 'video',
- 'p'
- ],
- repFunc = function (wholeMatch, match, left, right) {
- var txt = wholeMatch;
- // check if this html element is marked as markdown
- // if so, it's contents should be parsed as markdown
- if (left.search(/\bmarkdown\b/) !== -1) {
- txt = left + globals.converter.makeHtml(match) + right;
- }
- return '\n\n¨K' + (globals.gHtmlBlocks.push(txt) - 1) + 'K\n\n';
- };
+ 'pre',
+ 'div',
+ 'h1',
+ 'h2',
+ 'h3',
+ 'h4',
+ 'h5',
+ 'h6',
+ 'blockquote',
+ 'table',
+ 'dl',
+ 'ol',
+ 'ul',
+ 'script',
+ 'noscript',
+ 'form',
+ 'fieldset',
+ 'iframe',
+ 'math',
+ 'style',
+ 'section',
+ 'header',
+ 'footer',
+ 'nav',
+ 'article',
+ 'aside',
+ 'address',
+ 'audio',
+ 'canvas',
+ 'figure',
+ 'hgroup',
+ 'output',
+ 'video',
+ 'p'
+ ],
+ repFunc = function (wholeMatch, match, left, right) {
+ var txt = wholeMatch;
+ // check if this html element is marked as markdown
+ // if so, it's contents should be parsed as markdown
+ if (left.search(/\bmarkdown\b/) !== -1) {
+ txt = left + globals.converter.makeHtml(match) + right;
+ }
+ return '\n\n¨K' + (globals.gHtmlBlocks.push(txt) - 1) + 'K\n\n';
+ };
for (var i = 0; i < blockTags.length; ++i) {
text = showdown.helper.replaceRecursiveRegExp(text, repFunc, '^ {0,3}<' + blockTags[i] + '\\b[^>]*>', '' + blockTags[i] + '>', 'gim');
diff --git a/src/subParsers/headers.js b/src/subParsers/headers.js
index 72eadcd..966f227 100644
--- a/src/subParsers/headers.js
+++ b/src/subParsers/headers.js
@@ -30,7 +30,7 @@ showdown.subParser('headers', function (text, options, globals) {
var spanGamut = showdown.subParser('spanGamut')(m1, options, globals),
hID = (options.noHeaderId) ? '' : ' id="' + headerId(m1) + '"',
hLevel = headerLevelStart + 1,
- hashBlock = '