有没有办法在每一行后面都加一个换行符



我正在制作一个文档页面,我正在尝试将文本粘贴到html段落中,并希望保持格式。当把下面的文本粘贴到我的html中时,它会显示在一起。我怎样才能在每一行后面加一个换行符?

function resolveAfter2Seconds() {
console.log("starting slow promise")
return new Promise(resolve => {
setTimeout(function() {
resolve("slow")
console.log("slow promise is done")
}, 2000)
})
}
function resolveAfter1Second() {
console.log("starting fast promise")
return new Promise(resolve => {
setTimeout(function() {
resolve("fast")
console.log("fast promise is done")
}, 1000)
})
}

使用pre标记将格式设置为已写入的

<pre>
this is 
an example
of how to use the pre tag
</pre>

最新更新