Onyx
Onyx

Reputation: 5772

How to use the \n newline symbol in markdown to push text to next line?

I'm about to submit an application to Zendesk, however, they require you to create a description for the application and they mention you can use Markdown to style it. The object I would submit with that information looks like this:

"app": {
    "name": "Application Name",
    "long_description": ""
}

And I need to set long_description to the Markdown. Now here's my issue - let's say I want the following 2 sentences like this:

Welcome to Application Name

Explanation about the application

I want them to have a new line between the 2 sentences and Zendesk says that I must use \n to achieve that, but they don't show any examples and there's no preview of how the application description would look like before uploading it, so I have to guess.

Do I need to set long_description to "Welcome to Application Name\nExplanation about the application" in order to achieve that space between the lines? I looked up Markdown's documentation and didn't really see \n symbol being used anywhere, so I'm a bit confused.

Upvotes: 4

Views: 14012

Answers (2)

nyctef
nyctef

Reputation: 571

Do I need to set long_description to "Welcome to Application Name\nExplanation about the application" in order to achieve that space between the lines?

Yes, that is probably correct. I think the thing you might be missing is that the \n is part of JSON, rather than markdown. So a JSON string like

"Welcome to Application Name\nExplanation about the application"

gets translated into the markdown string

Welcome to Application Name
Explanation about the application

As a side note, you may need multiple \n characters between the two lines - some flavors of markdown treat a single line break as continuing the same line.

Upvotes: 5

karel
karel

Reputation: 5851

Markdown uses the <br> tag from html instead of \n to start a new line, for example Welcome to Application Name<br>Explanation about the application which renders in the markdown editor's preview mode and on the webpage as follows.

Welcome to Application Name
Explanation about the application

Upvotes: 3

Related Questions