Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Escape frontmatter content in raw records so it handles newlines #41

Merged
merged 1 commit into from
Jan 13, 2020

Conversation

lukewestby
Copy link
Contributor

Hey Dillon!

This change escapes frontmatter content with JSON.stringify so that it handles newlines correctly. Without using JSON.stringify, newlines are included directly in the output which caus parsing failures. The difference looks like this:

Before:

"""{\"example\": \"hello\nworld\"}
"""

After:

"{\"example\": \"hello\\nworld\"}"

@dillonkearns
Copy link
Owner

Thank you so much Luke, this is great! I just encountered a similar problem with escaped quotes within frontmatter, and this solves that issue as well 🎉

@dillonkearns dillonkearns merged commit d9deee0 into dillonkearns:master Jan 13, 2020
@dillonkearns
Copy link
Owner

Just pushed out a release for this 👍 https://github.com/dillonkearns/elm-pages/blob/master/CHANGELOG-NPM.md#117---2020-01-12

Also, I've started adding contributors to the readme. But if you prefer not to, just let me know on the PR that it opens up and I'll close it, totally up to you 😄

@all-contributors please add @lukewestby for code.

@allcontributors
Copy link
Contributor

@dillonkearns

I've put up a pull request to add @lukewestby! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants