tidy-markdown
Advanced tools
Comparing version 0.3.1 to 0.3.2
@@ -119,3 +119,3 @@ // Generated by CoffeeScript 1.8.0 | ||
preprocessAST = function(ast) { | ||
var currentToken, e, i, nestingEndToken, nestingLevel, nestingStartToken, orderedList, orderedListItemNumber, out, subAST, token, tokenIndex, _i, _len, _ref, _ref1; | ||
var currentToken, e, i, nestingLevel, orderedList, orderedListItemNumber, out, subAST, token, tokenIndex, _i, _len, _ref, _ref1, _ref2, _ref3; | ||
i = 0; | ||
@@ -130,5 +130,3 @@ out = []; | ||
} else if (_ref = currentToken.type, __indexOf.call(nestingStartTokens, _ref) >= 0) { | ||
nestingStartToken = currentToken.type; | ||
tokenIndex = nestingStartTokens.indexOf(nestingStartToken); | ||
nestingEndToken = nestingEndTokens[tokenIndex]; | ||
tokenIndex = nestingStartTokens.indexOf(currentToken.type); | ||
currentToken.type = nestContainingTokens[tokenIndex]; | ||
@@ -139,6 +137,5 @@ i++; | ||
while (true) { | ||
if (ast[i].type === nestingEndToken) { | ||
if (_ref1 = ast[i].type, __indexOf.call(nestingEndTokens, _ref1) >= 0) { | ||
nestingLevel--; | ||
} | ||
if (ast[i].type === nestingStartToken) { | ||
} else if (_ref2 = ast[i].type, __indexOf.call(nestingStartTokens, _ref2) >= 0) { | ||
nestingLevel++; | ||
@@ -153,5 +150,5 @@ } | ||
e = 0; | ||
_ref1 = preprocessAST(subAST); | ||
for (_i = 0, _len = _ref1.length; _i < _len; _i++) { | ||
token = _ref1[_i]; | ||
_ref3 = preprocessAST(subAST); | ||
for (_i = 0, _len = _ref3.length; _i < _len; _i++) { | ||
token = _ref3[_i]; | ||
if (token.nesting == null) { | ||
@@ -303,3 +300,3 @@ token.nesting = []; | ||
module.exports = function(dirtyMarkdown, options) { | ||
var ast, content, id, line, link, links, openLooseItem, optionalTitle, out, previousToken, token, _i, _j, _len, _len1, _ref, _ref1, _ref2; | ||
var ast, content, id, line, link, links, optionalTitle, out, previousToken, token, _i, _j, _len, _len1, _ref, _ref1, _ref2; | ||
if (options == null) { | ||
@@ -323,14 +320,2 @@ options = {}; | ||
}); | ||
openLooseItem = false; | ||
ast = ast.map(function(token) { | ||
if (token.type === 'loose_item_start') { | ||
openLooseItem = true; | ||
} else if (token.type === 'list_item_end' && openLooseItem) { | ||
openLooseItem = false; | ||
token = { | ||
type: 'loose_item_end' | ||
}; | ||
} | ||
return token; | ||
}); | ||
ast = preprocessAST(ast); | ||
@@ -337,0 +322,0 @@ ast = fixHeaders(ast, options.ensureFirstHeaderIsH1); |
{ | ||
"name": "tidy-markdown", | ||
"description": "fix ugly markdown.", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"author": "Sean Lang", | ||
@@ -6,0 +6,0 @@ "bin": { |
53257
396