I am trying to document my APIs using GraphQL. For readability issues, I want to leave comments in multi-line but it doesn't seem to work with regular '\n' newline symbol
"""
Return:\n true : DB save successful\n false : DB save unsuccessful
"""
This is what i tried
However it outputs exactly the same without putting lines in the new line
Return:\n true : DB save successful\n false : DB save unsuccessful
Is it possible to arrange texts in new line like:
Return:
true : DB save successful
false : DB save unsuccessful
Block strings don't allow escaping characters by design, but you can just utilize new lines inside the string:
"""
Return:
true : DB save successful
false : DB save unsuccessful
"""
Or you can utilize a regular string, which allows escaped characters:
"Return:\n true : DB save successful\n false : DB save unsuccessful"
EDIT:
GraphQL Playground uses this component under the hood to render the descriptions, which itself treats the description as markdown and renders it using markdown-it. Markdown ignores single line breaks, so you would have to use two:
"""
Return:
true : DB save successful
false : DB save unsuccessful
"""
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With