有没有简单的方法可以保留诗歌开头的空格和其他格式?

也可以使用反引号(```),这样可以保留格式,但你可能不喜欢其样式

hello world
 this is a line with a leading space
  this is a line with 2 leading spaces
   this is a line with 3 leading spaces

如果你能访问 TC,可以添加一些简单的 CSS 来缓解这个问题:

code.lang-plaintext {
  font-family: cursive;
  font-size: inherit;
  background: transparent;
  color: inherit;
}
pre:has(code.lang-plaintext) {
  background: transparent;
  border: none;
  padding: 0;
}
```\n
效果如下(例如):

![CleanShot 2026-07-20 at 08.19.42@2x|690x233](upload://3uT9n52JJh2boYtqaqm3yUUsWyz.png)

但当然,只有在没有人发布真正的代码片段(反引号的传统用途)时,这才会是一个好办法。不过我想在诗歌论坛上这种情况的可能性很低 :slight_smile: