hanford/remark-slate

Inserting commas at newlines?

Closed this issue · 1 comments

Thanks so much for working on this!

When using the serializer as you've laid out in the example code:

return nodes.map((v) => serialize(v)).join()

I get this JSON:

[
  {
    "type":"paragraph",
    "children":
      [{"text":"Testing the markdown serializer"}]
  },
  {
    "type":"paragraph",
    "children":
      [{"text":"It keeps inserting commas"}]
  },
  {
    "type":"paragraph",
    "children":
      [{"text":"What am I doing wrong?","bold":true}]
  }
]

And when I put that JSON into the serialize function, I get this Markdown:

Testing the markdown serializer
,It keeps inserting commas
,**What am I doing wrong?**

With commas inserted at every new line. So close! Any help would be appreciate. Thanks again!

Ah, I think is a documentation bug.

Updating the join to this should work:

- return nodes.map((v) => serialize(v)).join()
+ return nodes.map((v) => serialize(v)).join('')

I'll update the README