我在一个 Discourse 社区中担任版主,正在为 Gene Keys 社区进行测试,有参与者询问是否允许在诗歌中使用格式。
关于格式的常见问题解答描述了 HTML 和其他代码选项,但这些对普通用户来说并不简单。
请告知是否有简便的解决方案。
谢谢,David
我在一个 Discourse 社区中担任版主,正在为 Gene Keys 社区进行测试,有参与者询问是否允许在诗歌中使用格式。
关于格式的常见问题解答描述了 HTML 和其他代码选项,但这些对普通用户来说并不简单。
请告知是否有简便的解决方案。
谢谢,David
hi @pinetree1111
欢迎
我不确定你是否认为这“简单”,但我觉得挺简单的,因为我偶尔在帖子里就用过,哈哈。
你可以用 来表示空格:
像这样
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
代码:
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
你也可以在它们之间加空格
hello world
this is a line with 2 leading spaces
this is a line with 4 leading spaces
this is a line with 6 leading spaces
hello world
this is a line with 2 leading spaces
this is a line with 4 leading spaces
this is a line with 6 leading spaces
要是工具栏里能有这个功能就太好了——尤其是对那些不用 Markdown 的人来说,对吧?
不太确定,但我认为这个组件可以添加自定义按钮?无论如何,对于有一定编程技能的人来说,制作一个主题组件并不是特别困难。我自己用不上它,但如果有人需要,我想我可以帮他们。至于所见即所得编辑器,我不太确定,因为我从不使用它。
也可以使用反引号(```),这样可以保留格式,但你可能不喜欢其样式
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
效果如下(例如):

但当然,只有在没有人发布真正的代码片段(反引号的传统用途)时,这才会是一个好办法。不过我想在诗歌论坛上这种情况的可能性很低 :slight_smile:
我认为最简单的两个解决方案是:
使用“预格式化文本”:
只需输入带有空格的文本,选中它,然后使用
按钮来格式化文本。
或者,你可以选中这些行并输入 CTRL+E。
这与上面建议的 反引号 解决方案完全相同。
使用 <pre> HTML 标签 (我知道你询问的是避免使用 HTML 的解决方案,但这非常简单):
像这样用 HTML 标签将文本括起来:
<pre>
Text
with
leading
spaces.
</pre>
输出效果如下:
Text
with
leading
spaces.
非常感谢您的评论。我有一些编程经验,但已经很久没有使用(甚至已经忘记了  ),我看看早上能不能试着玩一下这个。我们有一个技术团队,如果我们决定永久使用这个论坛,他们会将论坛集成到新网站中,所以听起来他们可能能够为普通用户创建一个按钮。