1. ホーム
  2. markdown

[解決済み] How to insert a line break <br> in markdown

2022-03-08 02:06:03

Question

I'm trying to create a Markdown file with some paragraphs containing both a link and a line of text on the next line. The problem I've encountered is that when I make a new line after the link, it is rendered with a separate <p> tag.

My Markdown is the following:

[Name of link](url)

My line of text

Which is rendered to the following HTML:

<p>
   <a href="url">Name of link</a>
</p>
<p>My line of text</p>

Instead I want it to render like so:

<p>
    <a href="url">Name of link</a><br>  // not necessarily with a <br> tag but on a separate line
    My line of text
</p>

I've also tried using a single line break in the Markdown:

[Name of link](url)
My line of text

しかし、その場合、リンクとテキストの両方が同じ行にレンダリングされますが、改行されることはありません。

これを解決する方法について、何か提案があれば教えてください。

どのように解決するのですか?

スペース2つ(またはバックスラッシュ)を追加してみてください。 \ ) の後、最初の行を削除してください。

[Name of link](url)
My line of text\

視覚的に

[Name of link](url)<space><space>
My line of text\

出力します。

<p><a href="url">Name of link</a><br>
My line of text<br></p>


または <br> を直接テキストに挿入します。Markdownで有効です。