Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
β Type of change
π Description
Currently newlines are escaped when putting strings as fields into @nuxt/content. That means that the newlines that are returned from e.g.
queryCollection
aren't real newlines but slashes followed by an n char. This is clearly visible when converting the field value to JSON, then the output looks something likeline1\\nline2
instead ofline1\nline2
. Concretely this breaks my nuxt-content-body-html module that generates a html for @nuxt/content posts. In the final result e.g. in code blocks, there will just be\n
strings instead of real line breaks.I think there are two issues:
I've fixed them by keeping the newlines in the queries and using JSON.stringify and JSON.parse to communicate the dump between server and client instead of spliting by
\n
.I haven't fixed the tests yet since I don't know yet if the PR gets merged.
Reproduction
https://codesandbox.io/p/devbox/j4yj8k