aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/writers/markdown-writer.js14
1 files changed, 5 insertions, 9 deletions
diff --git a/lib/writers/markdown-writer.js b/lib/writers/markdown-writer.js
index 6fed677..5db7cab 100644
--- a/lib/writers/markdown-writer.js
+++ b/lib/writers/markdown-writer.js
@@ -30,11 +30,11 @@ function markdownImage(attributes) {
function markdownList(options) {
return function(attributes, list) {
return {
- start: list.indent > -1 ? "\n" : "",
- end: list.indent > -1 ? "" : "\n",
+ start: list ? "\n" : "",
+ end: list ? "" : "\n",
list: {
isOrdered: options.isOrdered,
- indent: list.indent + 1,
+ indent: list ? list.indent + 1 : 0,
count: 0
}
};
@@ -43,7 +43,7 @@ function markdownList(options) {
function markdownListItem(attributes, list) {
list.count++;
- var start = repeatString("\t", Math.max(list.indent, 0)) +
+ var start = repeatString("\t", list.indent) +
(list.isOrdered ? list.count + "." : "-") + " ";
return {start: start, end: "\n"};
@@ -78,11 +78,7 @@ function repeatString(value, count) {
function markdownWriter() {
var fragments = [];
var elementStack = [];
- var list = {
- indent: -1,
- isOrdered: false,
- count: 0
- };
+ var list = null;
function open(tagName, attributes) {
attributes = attributes || {};