如何在Confluence中这样格式化内联代码?我的意思是,不是一个单独的代码块,而只是内联类名。


当前回答

汇合之后

对于合流4及以上版本,输入两个花括号不起作用。

你现在需要选择Monospace字体。突出显示要更改的文本,并:

Windows操作系统:Ctrl + Shift + M

Mac: Command + Shift + M

或者,您可以键入一个反撇号('),Confluence将格式化所有内容,直到您键入另一个反撇号

或者,在粗体和斜体选项旁边,你可以点击“更多”下拉菜单,选择Monospace:

其他回答

若要在文本内格式化代码,请使用' "字符将代码括起来。通常位于键盘上“1”键的左边。

例子:

`printf("Hello World");`

与Stack Exchange相同的分隔符!

如果您想插入具有可选行号的大代码块等,请使用代码宏(在宏-> Other下可用)。

在Confluence 5.4.2中,你可以在源代码编辑器中添加<code></code>标签包围你的内联代码:

Confluence will show <code>this inline code</code> in a fixed font. 

这在需要修改许多片段的情况下非常有用,因为双大括号功能仅在Confluence编辑器中以交互方式添加文本时有效。

用{{}}包围内联文本。

警告:

You have to hit the spacebar after }} You can't copy inline preformatted text and maintain it's look. If you do copy it you might not be able to add {{ }} to fix it. Just retype it or paste without formatting (Cmd ⌘+Shift+V on Mac) then add {{ }} and hit space. If you add the {{ }} to existing text later, it can not be surrounded by other characters, e.g. if you want parenthesis around your preformatted text, you cannot fix (my text) by adding braces ({{my text}}). First add space around your text ( my text ) then add the {{ }}.

所有这些其他答案听起来都是好主意,我建议首先使用它们,但为了完整性起见,我将继续在列表中添加一个。

您可以简单地使用html宏,然后粘贴内容包装在<pre> </pre>标签。