jonschlinkert / gray-matter

Smarter YAML front matter parser, used by metalsmith, Gatsby, Netlify, Assemble, mapbox-gl, phenomic, vuejs vitepress, TinaCMS, Shopify Polaris, Ant Design, Astro, hashicorp, garden, slidev, saber, sourcegraph, and many others. Simple to use, and battle tested. Parses YAML by default but can also parse JSON Front Matter, Coffee Front Matter, TOML Front Matter, and has support for custom parsers. Please follow gray-matter's author: https://github.com/jonschlinkert
https://github.com/jonschlinkert
MIT License
3.93k stars 138 forks source link

Newline logic in stringify modifies the original markdown #96

Open katz12 opened 5 years ago

katz12 commented 5 years ago

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.

robertmassaioli commented 5 years ago

@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.

katz12 commented 5 years ago

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.

derek-knox commented 4 years ago

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?

katz12 commented 4 years ago

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.