Project

General

Profile

Actions

RedmineTextFormattingMarkdown » History » Revision 6

« Previous | Revision 6/32 (diff) | Next »
Hans Ginzel, 2015-12-07 15:36
Part of Inline images converted to Markdown


Markdown formatting

Below is copy of Textile formatting that needs to be updated to Markdown formatting. Please help.
For Markdown formatting see #15520 and #16373.

Links

Redmine links

Redmine allows hyperlinking between resources (issues, changesets, wiki pages...) from anywhere text formatting is used.

  • Link to an issue: #124 (displays #124, link is striked-through if the issue is closed)
  • Link to an issue note: #124-6, or #124!#note-6
  • Link to a changeset: r758 (displays r758)
  • Link to a changeset with a non-numeric hash: commit:c6f4d0fd (displays c6f4d0fd).

Wiki links:

  • [[Guide]] displays a link to the page named 'Guide': Guide
  • [[Guide|User manual]] displays a link to the same page but with different text: User manual
  • [[Guide#User-guide|User guide]] displays a link to the header on the same page with different text: User guide

You can also link to pages of another project's wiki (using the project identifier):

  • [[sandbox:some page]] displays a link to the page named 'Some page' of the Sandbox wiki
  • [[sandbox:]] displays a link to the Sandbox wiki main page

Wiki links are displayed in red if the page doesn't exist yet, eg: Nonexistent page.

Links to others resources:

  • Documents:
    • document#17 (link to document with id 17)
    • document:Greetings (link to the document with title "Greetings")
    • document:"Some document" (double quotes can be used when document title contains spaces)
    • sandbox:document:"Some document" (link to a document with title "Some document" in project identifier "sandbox")
  • Versions:
    • version#3 (link to version with id 3)
    • version:1.0.0 (link to version named "1.0.0")
    • version:"1.0 beta 2" (double quotes can be used when version name contains spaces)
    • sandbox:version:1.0.0 (link to version "1.0.0" in the project identifier "sandbox")
  • Attachments:
    • attachment:file.zip (link to the attachment of the current object named file.zip)
    • attachment:"file.zip" (double quotes can be used when the filename contains non word characters)
    • For now, attachments of the current object can be referenced only (if you're on an issue, it's possible to reference attachments of this issue only)
  • Changesets:
    • r758 (link to a changeset)
    • commit:c6f4d0fd (link to a changeset with a non-numeric hash)
    • svn1|r758 (link to a changeset of a specific repository, for projects with multiple repositories)
    • commit:hg|c6f4d0fd (link to a changeset with a non-numeric hash of a specific repository)
    • sandbox:r758 (link to a changeset of another project)
    • sandbox:commit:c6f4d0fd (link to a changeset with a non-numeric hash of another project identifier)
  • Repository files:
    • source:some/file -- Link to the file located at /some/file in the project's repository
    • source:some/file@52 -- Link to the file's revision 52
    • source:some/file#L120 -- Link to line 120 of the file
    • source:some/file@52#L120 -- Link to line 120 of the file's revision 52
    • source:"some file@52#L120" -- Double quotes can be used when the URL contains spaces
    • source:repo_identifier|some/file -- Link to a file in a repository other than the project default repository.
    • source:"repo_identifier|some file" -- Link to a file in a repository other than the project default repository, with spaces in the path.
    • export:some/file -- Force the download of the file
  • Forums:
    • forum#2 (link to forum with id 2)
    • forum:Discussion (link to forum with name "Discussion")
    • forum:"Help and more" (double quotes can be used when forum name contains spaces)
  • Forum messages:
    • message#1218 (link to message with id 1218)
  • News items
    • news#1 (link to news item with id 1)
    • news:Greetings (link to news item with name "Greetings")
    • news:"eCookbook first release !" (double quotes can be used when news item name contains spaces)
  • Projects:
    • project#3 (link to project with id 3)
    • project:someproject (link to project with name "someproject")
    • project:"Multiple words project" (double quotes can be used when project name contains spaces)

Escaping:

  • You can prevent Redmine links from being parsed by preceding them with an exclamation mark: !

External links

HTTP URLs are automatically turned into clickable links: HTTP URLs can also use different text than the link itself:
  • [Redmine web site](http://www.redmine.org) -- External link with different text: Redmine web site
  • [![Redmine web site](http://www.redmine.org/attachments/7069/Redmine_logo.png)](http://www.redmine.org) -- External image with a title that links to an URL:

Redmine web site

Email addresses

Email addresses are automatically turned into clickable links:

  • [Email someone](mailto:someone@foo.bar) -- Email link with different text: Email someone
More complex email instructions can be added to an email link. A default subject, default body and CC information can be defined. Note that spaces in any of these fields need to be replaced with the code %20.
  • [Email webmaster and admin](mailto:webmaster@foo.bar?cc=admin@foo.bar) -- Email to webmaster, CC admin: Email webmaster and admin
  • [Email someone for help](mailto:someone@foo.bar?subject=Website%20Help) -- Email link with the subject "Website Help": Email someone for help
  • [Email someone for help](mailto:someone@foo.bar?subject=Website%20Help&body=My%20problem%20is%20) -- Email link with the subject "Website Help" and a default body: Email someone for help

Text formatting

For things such as headlines, bold, tables, lists, Redmine supports Markdown syntax. See http://daringfireball.net/projects/markdown/syntax, http://agea.github.io/tutorial.md/, http://stackoverflow.com/editing-help for information on using any of these features. A few samples are included below, but the engine is capable of much more of that. For conversions see Pandoc. The Redcarpet formatter is used.

Acronym

?? in Markdown

JPL(Jean-Philippe Lang)

Display:

JPL

Font style

* **bold** __bold__
* *italic* _italic_
* ***bold italic*** ___bold italic___
* <ins>underline</ins>
* <del>strike through</del>
* Plain <sup>superscript</sup>
* Plain <sub>subscript</sub>
* `inline monospace`
* normal **bold** _italic_ normal;E=mc<sup>2</sup>
* normal<notextile></notextile>*bold*<notextile></notextile>_italic_<notextile></notextile>normal;E=mc<notextile></notextile>^2^
* Escaping: <notextile>*bold* _italic_ @inlinemono@</notextile> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Alternative using HTML-codes: &#42;bold&#42; &#95;italic&#95; &#64;inlinemono&#64;
* <pre>*some lines*      some "link":http://www.redmine.org</pre>
* <pre><notextile></notextile>*some lines*      some "link":http://www.redmine.org</pre>

Display:

  • bold bold
  • italic italic
  • bold italic bold italic
  • underline
  • strike-through
  • Plain superscript
  • Plain subscript
  • inline monospace
  • normal bold italic normal;E=mc 2
  • normalbolditalicnormal;E=mc2
  • Escaping: *bold* _italic_ @inlinemono@       Alternative using HTML-codes: *bold* _italic_ @inlinemono@
  • *some lines*      some "link":http://www.redmine.org
  • some lines      some link

Colour

* %{color:red}red% %{color:green}green% %{color:yellow}yellow% %{color:#82B6E1}blue'ish%
* %{color:red}red%<notextile></notextile>%{color:green}green%<notextile></notextile>%{color:yellow}yellow%<notextile></notextile>%{color:#82B6E1}blue'ish%
* %{background:lightgreen}Lightgreen Background% %{background:yellow}Yellow Background%
* %{background:lightgreen}Lightgreen Background%<notextile></notextile>%{background:yellow}Yellow Background%

Display:

  • red green yellow blue'ish
  • redgreenyellowblue'ish
  • Lightgreen Background Yellow Background
  • Lightgreen BackgroundYellow Background

Inline images

If you have an image attached to your wiki page, it can be displayed inline using its filename: !attached_image.png!

You can also apply a CSS style to the image in the same ways as styling SPANs. The code !{width: 100%}attached_image.png! will make the image adjusts to the parent's width.

Headings

h1. Heading

h2. Subheading

h3. Subheading

Redmine assigns an anchor to each of those headings thus you can link to them with "#Heading", "#Subheading" and so forth.

Paragraphs

p. left aligned

  p(. left ident 1em

    p((. left ident 2em
    as well as for following lines

                                                                                   p>. right aligned

                                                                        p)))>. right ident 3em

                           p=. This is centered paragraph.

Horizontal rule

----
Display:


Predefined

To escape wiki syntax

 <pre> *Your text won't become bold* </pre> 

Display:

 *Your text won't become bold* 

Blockquotes

Start the paragraph with 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.

Displays:

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.

You can also use > at the beginning of each line and stack them for nested quotes:

>> 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.
> Great!

Displays:

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.

Great!

Unordered lists

* Item 1
* Item 2
** Item 21
** Item 22
* Item 3

displays:

  • Item 1
  • Item 2
    • Item 21
    • Item 22
  • Item 3

Ordered lists

# Item 1
# Item 2
# Item 3
## Item 3.1
## Item 3.2

displays:

  1. Item 1
  2. Item 2
  3. Item 3
    1. Item 3.1
    2. Item 3.2

Tables

|_.UserID      |_.Name          |_.Group     |_. attribute list   |
|Starting with | a              |   simple   |row                 |
|\3=.IT                                      |<. align left       |
|1             |Artur Pirozhkov |/2.Users    |>. align right      |
|2             |Vasya Rogov     |=. center   |
|3             |John Smith      |Admin
                                 (root)      |^. valign top       |
|4             |-               |Nobody
                                 (anonymous) |~. valign bottom    |

displays (all multiple spaces are replaced by 1 space):

UserID Name Group attribute list
Starting with a simple row
IT align left
1 Artur Pirozhkov Users align right
2 Vasya Rogov center
3 John Smith Admin
(root)
valign top
4 - Nobody
(anonymous)
valign bottom

If you want to include pipe characters inside your table (e.g. for Wiki links), you need to prevent textile from interpreting them:

Input Output
<notextile>|</notextile> |

Table of content

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

Please keep in mind, that the toc-tag needs an empty line above and underneath it and no other text before and after it.

Example:


h1. headLineOne

h2. something

{{toc}}

h2. something more

Macros

Redmine includes a macros system that lets you add custom functions to insert dynamic content in formatted text. You can learn about writing your own macros in RedmineMacros. Redmine also includes a few builtin macros:

hello_world
Sample macro.
macro_list
Displays a list of all available macros, including description if available.
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(depth=2)}} -- display 2 levels nesting only
{{child_pages(Foo)}} -- lists all children of page Foo
{{child_pages(Foo, parent=1)}} -- same as above with a link to page Foo
include
Includes a wiki page. Examples:

{{include(Foo)}}
{{include(projectname:Foo)}} -- to include a page of a specific project wiki
collapse
Inserts of collapsed block of text. Examples:

{{collapse
This is a block of text that is collapsed by default.
It can be expanded by clicking a link.
}}

{{collapse(View details...)
With custom link text.
}}
thumbnail
Displays a clickable thumbnail of an attached image.
Default size is 200 pixels. Examples:

{{thumbnail(image.png)}}
{{thumbnail(image.png, size=300, title=Thumbnail)}} -- with custom title and size
issue
Displays an issue link including additional information. Examples:

{{issue(123)}}                              -- Issue #123: Enhance macro capabilities
{{issue(123, project=true)}}                -- Andromeda - Issue #123: Enhance macro capabilities
{{issue(123, tracker=false)}}               -- #123: Enhance macro capabilities
{{issue(123, subject=false, project=true)}} -- Andromeda - Issue #123
sample_macro
Sample macro

Code highlighting

Code highlighting relies on CodeRay, a fast syntax highlighting library written completely in Ruby. It currently supports C, C++, CSS, Delphi, Diff, Groovy, HTML, Java, Javascript, JSON, Nitro-XHTML, PHP, Python, RHTML, Ruby, Scheme, SQL, XML and YAML code.

You can highlight code in your wiki page using this syntax:

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

Example:

# The Greeter class
class Greeter
  def initialize(name)
    @name = name.capitalize
  end

  def salute
    puts "Hello #{@name}!" 
  end
end

Textile formatting

Redmine supports textile formatting. For details see Textile syntax

Additional supported textiles:
  • %{background:lightgreen}Green Background% displays Green Background

Translation

Note that the following translations may not be up to date. Please refer to the original english documentation if needed.

Updated by Hans Ginzel almost 9 years ago · 6 revisions