gray-matter icon indicating copy to clipboard operation
gray-matter copied to clipboard

Newline logic in stringify modifies the original markdown

Open katz12 opened this issue 5 years ago • 4 comments

The logic for newline in stringify.js will add a newline to the end of the markdown document if it did not already exist.

This is obviously a matter of opinion, but I think it would be best if stringify did not alter the original markdown in any way except to add front matter.

katz12 avatar May 14 '19 20:05 katz12

@katz12 What impact is this having on your Markdown documents, and how they are used / rendered, if any? Currently, this seems like a low priority issue.

robertmassaioli avatar May 20 '19 04:05 robertmassaioli

The impact is fairly use case specific, but I have a need to ensure that a markdown document does not change in any unexpected ways.

Feel free to treat this as low priority as I have changed my approach and am no longer using gray-matter.

katz12 avatar May 20 '19 15:05 katz12

Feel free to treat this as low priority as I have changed my approach and am no longer using gray-matter.

@katz12 Out of curiosity, what is your approach now?

derek-knox avatar Sep 03 '20 12:09 derek-knox

I think I ended up hand rolling my own parser/writer that doesn't add newlines. But I also switched to using a JSON format for the front matter, so gray-matter would not have worked for me.

katz12 avatar Sep 03 '20 18:09 katz12