diff --git a/.eslintrc b/.eslintrc index 22b3069..c8c0320 100644 --- a/.eslintrc +++ b/.eslintrc @@ -5,8 +5,10 @@ }, "plugins": ["nodeca"], "rules": { + "array-bracket-spacing": [ 2, "always" ], "block-scoped-var": 2, - "brace-style": [ 2, '1tbs', { allowSingleLine: true } ], + "brace-style": [ 2, "1tbs", { allowSingleLine: true } ], + "comma-dangle": [ 2, "never" ], "comma-spacing": 2, "comma-style": 2, "consistent-this": [ 2, self ], @@ -27,7 +29,6 @@ "no-bitwise": 2, "no-caller": 2, "no-catch-shadow": 2, - "no-comma-dangle": 2, "no-cond-assign": 2, "no-console": 1, "no-constant-condition": 2, @@ -37,7 +38,7 @@ "no-dupe-keys": 2, "no-div-regex": 2, "no-empty": 2, - "no-empty-class": 2, + "no-empty-character-class": 2, "no-empty-label": 2, "no-else-return": 2, "no-eq-null": 2, @@ -45,8 +46,8 @@ "no-extend-native": 2, "no-extra-bind": 2, "no-extra-boolean-cast": 2, + "no-extra-parens": 2, "no-extra-semi": 2, - "no-extra-strict": 2, "no-eval": 2, "no-floating-decimal": 2, "no-func-assign": 2, @@ -75,13 +76,11 @@ "no-path-concat": 2, "no-redeclare": 2, "no-regex-spaces": 2, - "no-reserved-keys": 2, "no-return-assign": 2, "no-script-url": 2, "no-sequences": 2, "no-shadow": 2, "no-shadow-restricted-names": 2, - "no-space-before-semi": 2, "no-sparse-arrays": 2, "no-trailing-spaces": 2, "no-undef": 2, @@ -92,21 +91,19 @@ "no-unused-vars": 2, "no-use-before-define": 2, "no-with": 2, - "no-wrap-func": 2, + "object-curly-spacing": [ 2, "always" ], "quotes": [ 2, "single", "avoid-escape" ], "radix": 2, "semi": 2, + "semi-spacing": [ 2, { "before": false, "after": true } ], "space-after-keywords": [ 2, "always" ], "space-before-blocks": 2, - "space-in-brackets": [ 2, "always", { - "propertyName": false - } ], "space-in-parens": [ 2, "never" ], "space-infix-ops": 2, "space-return-throw-case": 2, "space-unary-ops": 2, - "spaced-line-comment": [ 2, "always", { "exceptions": [ "/" ] } ], - "strict": 2, + "spaced-comment": [ 2, "always", { "exceptions": [ "/" ] } ], + "strict": [ 2, "global" ], "use-isnan": 2, "yoda": 2, "valid-typeof": 2, diff --git a/index.js b/index.js index 9774a21..2056b68 100644 --- a/index.js +++ b/index.js @@ -159,12 +159,13 @@ function makeMath_block(open, close) { pos = state.skipSpaces(pos); if (pos < max) { continue; } + haveEndMarker = true; // found! break; } - // If math block has heading spaces, the should be removed from its inner block + // If math block has heading spaces, they should be removed from its inner block len = state.tShift[startLine]; state.line = nextLine + (haveEndMarker ? 1 : 0); @@ -183,7 +184,7 @@ function makeMath_block(open, close) { function makeMathRenderer(options) { var mathml = ascii2mathml(Object.assign({}, options)); - return (options && options.display === 'block') ? + return options && options.display === 'block' ? function(tokens, idx) { return mathml(tokens[idx].content) + '\n'; } : diff --git a/lib/polyfills.js b/lib/polyfills.js index eaea794..d3e5875 100644 --- a/lib/polyfills.js +++ b/lib/polyfills.js @@ -1,3 +1,4 @@ +'use strict'; /* Object.assign * @@ -14,7 +15,6 @@ if (!Object.assign) { configurable: true, writable: true, value: function(target) { - 'use strict'; if (typeof target === 'undefined' || target === null) { throw new TypeError('Cannot convert first argument to object'); } diff --git a/package.json b/package.json index 85d0556..6d3f3fc 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "browserify": "(echo \"/*! ${npm_package_name} ${npm_package_version} ${npm_package_homepage} @license MIT */\"; browserify ./ -s markdownitMath) > dist/markdown-it-math.js", "predist": "npm run test", "dist": "rm -fr dist; mkdir dist; npm run browserify; npm run minify", - "lint": "eslint --reset index.js lib/", + "lint": "eslint index.js lib/", "minify": "uglifyjs dist/markdown-it-math.js -b beautify=false,ascii-only=true -c -m --preamble \"/*! ${npm_package_name} ${npm_package_version} ${npm_package_homepage} @license MIT */\" > dist/markdown-it-math.min.js", "prepublish": "npm run dist", "pretest": "npm run lint", @@ -34,12 +34,12 @@ }, "homepage": "https://github.com/runarberg/markdown-it-math", "dependencies": { - "ascii2mathml": "^0.2.5" + "ascii2mathml": "^0.5.2" }, "devDependencies": { - "babelify": "^5.0.4", - "browserify": "^9.0.4", - "eslint": "^0.18.0", + "babelify": "^6.3.0", + "browserify": "^11.0.1", + "eslint": "^1.3.1", "eslint-plugin-nodeca": "^1.0.3", "markdown-it": "^4.1.0", "markdown-it-testgen": "^0.1.4",