tidy-markdown
Advanced tools
Comparing version 2.0.2 to 2.0.3
@@ -275,3 +275,3 @@ // Generated by CoffeeScript 1.10.0 | ||
module.exports = function(dirtyMarkdown, options) { | ||
var ast, content, html, j, k, l, len, len1, len2, link, links, m, name, node, nodes, optionalTitle, out, rawLinks, ref1, root, title, url, value; | ||
var ast, content, error, html, j, k, l, len, len1, len2, link, links, m, name, node, nodes, optionalTitle, out, rawLinks, ref1, root, title, url, value; | ||
if (options == null) { | ||
@@ -287,7 +287,12 @@ options = {}; | ||
out = ''; | ||
content = fm(dirtyMarkdown); | ||
if (Object.keys(content.attributes).length !== 0) { | ||
out += '---\n' + yaml.safeDump(content.attributes).trim() + '\n---\n\n'; | ||
try { | ||
content = fm(dirtyMarkdown); | ||
if (Object.keys(content.attributes).length !== 0) { | ||
out += '---\n' + yaml.safeDump(content.attributes).trim() + '\n---\n\n'; | ||
} | ||
content = content.body; | ||
} catch (error) { | ||
content = dirtyMarkdown; | ||
} | ||
ast = marked.lexer(content.body); | ||
ast = marked.lexer(content); | ||
rawLinks = ast.links; | ||
@@ -294,0 +299,0 @@ links = []; |
{ | ||
"name": "tidy-markdown", | ||
"description": "Fix ugly markdown.", | ||
"version": "2.0.2", | ||
"version": "2.0.3", | ||
"author": "Sean Lang", | ||
@@ -6,0 +6,0 @@ "bin": { |
70845
964