12345678910111213141516171819202122232425 |
- showdown.subParser('makeMarkdown.listItem', function (node, globals) {
- 'use strict';
- var listItemTxt = '';
- var children = node.childNodes,
- childrenLenght = children.length;
- for (var i = 0; i < childrenLenght; ++i) {
- listItemTxt += showdown.subParser('makeMarkdown.node')(children[i], globals);
- }
- // if it's only one liner, we need to add a newline at the end
- if (!/\n$/.test(listItemTxt)) {
- listItemTxt += '\n';
- } else {
- // it's multiparagraph, so we need to indent
- listItemTxt = listItemTxt
- .split('\n')
- .join('\n ')
- .replace(/^ {4}$/gm, '')
- .replace(/\n\n+/g, '\n\n');
- }
- return listItemTxt;
- });
|