Nested lists
Closed this issue ยท 5 comments
Hi,
At the moment there is a problem with nested lists. The code I'm using, the intended output and the actual output are as follow:
Code:
let md = json2md({
ol: [
'a',
{
ul: [
'I',
'II',
{ol: ['A', 'B']}
]
},
'b'
]
});
console.log(md);
Intended output:
- a
- I
- II
- A
- B
- b
Actual output:
-
a
-
- I
- II
-
- A
- B
-
b
--
I implemented a fix for this on my fork, but I had a problem with these lines, cause I couldn't figure out a way to only append \n
on the top level list. I decided to never append \n
to any list, but I guess this could be an issue somehow. Anyway, I updated the test file, hoping my solution will work fine.
Let me know what you think!
Hey @danielbastos11!
That's cool! I do see how this is currently a problem. Creating a pull request would be appreciated! โจ
Thanks!
Just did it!
Thanks for reviewing ๐
Thanks once again, I love that pull request! ๐
๐ข 1.5.6
You're very welcome ๐
@danielbastos11 I did a related change in #28. Adding new lines after the components. It turned out that #22 introduced some buggy behavior in some cases (I don't remember when, but it was about new lines).
#28 does not change the output preview of the nested lists, but the Markdown contains a couple of new lines.