Wiki文本格式

链接

Redmine的链接

Redmine允许在任何可以使用wiki文本格式的地方加入指向问题、变更版本或者wiki页面的超链接。

  • 连接到问题: #124 (显示为 #124, 如果此问题已关闭则将显示删除线)
  • 连接到变更版本: r758 (显示为 r758 )
  • 使用非数字的散列值连接到变更版本: commit:"c6f4d0fd" (显示为 c6f4d0fd )。从 r1236 版本开始支持。

指向Wiki的链接:

  • [[Guide]] 显示为指向名称为“Guide”的wiki页面的链接:Guide
  • [[Guide|User manual]] 显示为为指向同一页面的链接,但是显示文字不同: User manual

您还可以加入指向其它项目的wiki页面的链接:

  • [[sandbox:some page]] 显示为指向Sandbox项目的名称为'Some page'的wiki页面的链接
  • [[sandbox:]] 显示为指向Sandbox项目的wiki主页面的链接

如果Wiki还不存在,则连接将显示为红色,例如: Nonexistent page.

连接到其它资源 (0.7):

  • 文档:
    • document#17 (连接到编号为17的文档)
    • document:Greetings (连接到标题为“Greetings”的文档)
    • document:"Some document" (如果文档标题包含空格可以使用双引号括住)
  • 版本:
    • version#3 (连接到编号为3的版本)
    • version:1.0.0 (连接到名称为“1.0.0”的版本)
    • version:"1.0 beta 2"
  • 附件:
    • attachment:file.zip (连接到本页面上的名称为 file.zip 的附件)
    • 现在只能引用本页面自己的附件(如果您在编辑问题,则只能引用此问题的附件)
  • 版本库文件
    • source:some/file -- 连接到项目版本库的 /some/file 文件
    • source:some/file@52 -- 连接到上述文件的版本 52
    • source:some/file#L120 -- 连接到上述文件的第120行
    • source:some/file@52#L120 -- 连接到上述文件的版本 52 的第120行
    • export:some/file -- 强制显示为该文件的下载连接

转义字符(0.7):

  • 如果您不希望Redmine将上述标记解释为链接,可以在它们前面添加一个感叹号:!

外部链接

HTTP地址和邮件地址会被自动转换为可以点击的链接:

http://www.redmine.org, someone@foo.bar

显示为: http://www.redmine.org,

如果您不想直接显示URL,而是显示为某些文字,可以使用标准的textile语法:

"Redmine web site":http://www.redmine.org

显示为: Redmine web site

文本格式

对于标题、粗体、表格、列表,Redmine支持Textile语法。您可以查看 http://hobix.com/textile/ 上对这些功能的解释。下面会列出一些例子,但是Textile可以做的更多。

字体样式

* *bold*
* _italic_
* _*bold italic*_
* +underline+
* -strike-through-

显示为:

  • bold
  • italic
  • *bold italic*
  • underline
  • strike-through

内置图片

  • !image_url! 显示地址为image_url的图片(textile语法)
  • !>image_url! 漂浮在右侧的图片
  • 如果您的wiki页面有图片附件,则可以使用其文件名显示在页面上: !attached_image.png!

标题

h1. Heading
h2. Subheading
h3. Subheading

段落

p>. right aligned
p=. centered

This is centered paragraph.

块级引用 (Blockquotes)

在段落前加上 bq.

bq. Rails is a full-stack framework for developing database-backed web applications according to the Model-View-Control pattern.
To go live, all you need to add is a database and a web server.

显示为:

Rails is a full-stack framework for developing database-backed web applications according to the Model-View-Control pattern.
To go live, all you need to add is a database and a web server.

目录

{{toc}} => left aligned toc
{{>toc}} => right aligned toc

Redmine内置以下宏命令:

child_pages

Displays a list of child pages. With no argument, it displays the child pages of the current wiki page. Examples:

{{child_pages}} -- can be used from a wiki page only
{{child_pages(Foo)}} -- lists all children of page Foo
{{child_pages(Foo, parent=1)}} -- same as above with a link to page Foo
hello_world

Sample macro.

include

Include a wiki page. Example:

{{include(Foo)}}

or to include a page of a specific project wiki:

{{include(projectname:Foo)}}
macro_list

Displays a list of all available macros, including description if available.

代码的语法着色

代码的语法着色通过 CodeRay 来实现,它是一个完全用Ruby编写的快速的语法着色库。现在支持的语言包括:c, html, javascript, rhtml, ruby, scheme, xml.

使用以下语法对代码进行语法着色:

<pre><code class="ruby">
  Place you code here.
</code></pre>

例如:

 1 # The Greeter class
 2 class Greeter
 3   def initialize(name)
 4     @name = name.capitalize
 5   end
 6 
 7   def salute
 8     puts "Hello #{@name}!" 
 9   end
10 end

Also available in: HTML TXT