diff --git a/dist/showdown.js b/dist/showdown.js index 4e4c1a8..44b2eec 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 372575b..ffe571e 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 21d567d..ecd9f83 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 f888d2e..60977d4 100644 Binary files a/dist/showdown.min.js.map and b/dist/showdown.min.js.map differ diff --git a/src/subParsers/makemarkdown/input.js b/src/subParsers/makemarkdown/input.js new file mode 100644 index 0000000..0b13f04 --- /dev/null +++ b/src/subParsers/makemarkdown/input.js @@ -0,0 +1,16 @@ +showdown.subParser('makeMarkdown.input', function (node, globals) { + 'use strict'; + + var txt = ''; + if (node.getAttribute('checked') !== null) { + txt += '[x]'; + } else { + txt += '[ ]'; + } + var children = node.childNodes, + childrenLength = children.length; + for (var i = 0; i < childrenLength; ++i) { + txt += showdown.subParser('makeMarkdown.node')(children[i], globals); + } + return txt; +}); diff --git a/src/subParsers/makemarkdown/node.js b/src/subParsers/makemarkdown/node.js index b17303f..d4e1a33 100644 --- a/src/subParsers/makemarkdown/node.js +++ b/src/subParsers/makemarkdown/node.js @@ -113,6 +113,10 @@ showdown.subParser('makeMarkdown.node', function (node, globals, spansOnly) { txt = showdown.subParser('makeMarkdown.break')(node, globals); break; + case 'input': + txt = showdown.subParser('makeMarkdown.input')(node, globals); + break; + default: txt = node.outerHTML + '\n\n'; } diff --git a/test/functional/makemarkdown/cases/features/tasklists.html b/test/functional/makemarkdown/cases/features/tasklists.html new file mode 100644 index 0000000..cf6ccdf --- /dev/null +++ b/test/functional/makemarkdown/cases/features/tasklists.html @@ -0,0 +1,8 @@ +
otherthings
diff --git a/test/functional/makemarkdown/cases/features/tasklists.md b/test/functional/makemarkdown/cases/features/tasklists.md new file mode 100644 index 0000000..eed4a77 --- /dev/null +++ b/test/functional/makemarkdown/cases/features/tasklists.md @@ -0,0 +1,8 @@ +# my things + +- foo +- [ ] bar +- [ ] baz +- [x] bazinga + +otherthings diff --git a/test/functional/makemarkdown/testsuite.features.js b/test/functional/makemarkdown/testsuite.features.js new file mode 100644 index 0000000..6dc5ca8 --- /dev/null +++ b/test/functional/makemarkdown/testsuite.features.js @@ -0,0 +1,23 @@ +/** + * Created by Estevao on 08-06-2015. + */ +var bootstrap = require('./makemarkdown.bootstrap.js'), + showdown = bootstrap.showdown, + assertion = bootstrap.assertion, + testsuite = bootstrap.getTestSuite('test/functional/makemarkdown/cases/features/'); + +describe('makeMarkdown() features testsuite', function () { + 'use strict'; + + describe('issues', function () { + for (var i = 0; i < testsuite.length; ++i) { + var converter; + if (testsuite[i].name === '#164.4.tasklists') { + converter = new showdown.Converter({tasklists: true}); + } else { + converter = new showdown.Converter(); + } + it(testsuite[i].name.replace(/-/g, ' '), assertion(testsuite[i], converter)); + } + }); +});