Skip to content

Commit 55a0476

Browse files
committed
Add final eol when needed
1 parent d82e19a commit 55a0476

File tree

2 files changed

+265
-244
lines changed

2 files changed

+265
-244
lines changed

lib/index.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,17 @@ function toMarkdown(tree, options) {
2323
options: settings,
2424
unsafePatterns: extensions.unsafe
2525
}
26+
var result = handle(tree, null, context, {before: '\n', after: '\n'})
2627

27-
return handle(tree, null, context, {before: '\n', after: '\n'})
28+
if (
29+
result &&
30+
result.charCodeAt(result.length - 1) !== 10 &&
31+
result.charCodeAt(result.length - 1) !== 13
32+
) {
33+
result += '\n'
34+
}
35+
36+
return result
2837

2938
function enter(name) {
3039
stack.push(name)

0 commit comments

Comments
 (0)