段落不分隔
Paragraphs not separating
我正在写博客,每次我撰写一篇包含多个段落的文章时,它会变得杂乱无章,而且都在同一段落中。
这是我在主页面ejs中写的显示文章内容的代码:
<% pos.forEach(function(post) { %>
<h3><u><%= post.title %></u></h3>
<p><%= post.post.substring(0, 101) + "..." %>
<a href="/post/<%= post.title %>">Read More</a>
</p>
<% }); %>
这是我为 post ejs 页面编写的代码:
<%- include('partials/header'); -%>
<h1><%= title %></h1>
<p><%= content %></p>
<%- include('partials/footer'); -%>
我假设您的内容包含换行符。您可以使用 <pre>
来呈现这些行
<pre><%= content %></pre>
https://www.w3schools.com/tags/tag_pre.asp
Text in a element is displayed in a fixed-width font, and the
text preserves both spaces and line breaks. The text will be displayed
exactly as written in the HTML source code.
我正在写博客,每次我撰写一篇包含多个段落的文章时,它会变得杂乱无章,而且都在同一段落中。
这是我在主页面ejs中写的显示文章内容的代码:
<% pos.forEach(function(post) { %>
<h3><u><%= post.title %></u></h3>
<p><%= post.post.substring(0, 101) + "..." %>
<a href="/post/<%= post.title %>">Read More</a>
</p>
<% }); %>
这是我为 post ejs 页面编写的代码:
<%- include('partials/header'); -%>
<h1><%= title %></h1>
<p><%= content %></p>
<%- include('partials/footer'); -%>
我假设您的内容包含换行符。您可以使用 <pre>
来呈现这些行
<pre><%= content %></pre>
https://www.w3schools.com/tags/tag_pre.asp
Text in a element is displayed in a fixed-width font, and the text preserves both spaces and line breaks. The text will be displayed exactly as written in the HTML source code.