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.89k stars 137 forks source link

apostrophe in frontmatter #141

Open codewithbugs01 opened 2 years ago

codewithbugs01 commented 2 years ago

If there is an apostrophe in the frontmatter it causes and invalid 'data' and 'content' values.

For example:

title: My Brother's Title author: Mike James

crystalfp commented 1 year ago

Make sense. This is invalid YAML. Normally I change title to title: My Brother’s Title or quoting the title as title: "My Brother's Title"

joyzhong commented 11 months ago

~Is there a way to have both single and double quotes in the value?~

Found a way - you can escape a single quote by doubling it: title: 'My Brother'’s Title'