Formatting inside fragments

This page lists the formatting you can use to generate HTML in your fragments. Fragmenta supports Textile formatting (via Redcloth), and you can also add eRuby statements directly into fragments, as well as templates.

Using Textile

Normally, when using fragments you won’t have to worry about HTML, as things like paragraphs are generated automatically for you, based on the line breaks in your document (you should leave a clear line between each paragraph to get the right formatting). If you wish to do something more complex, you can also add styling using textile, add HTML elements with custom classes and ids, or even embed straight HTML.

If you wish to turn off Textile formatting in a fragment, set the textile :: field to ‘no’.

Basic formatting

Italic text is created by surrounding text with underscores

_italic_ text

and bold text surrounded by stars

*bold* text

To insert a paragraph with a custom class or id, you can use p(the_class#the_id). Paragraph here

which gives you

<p class=”the_class” id=”the_id”>Paragraph here</p>

Inserting heads

Normally you won’t have to create heads, as Fragmenta will do this for you – each Fragment will have its title inserted between h3 tags. If you wish to have other heads, you can insert them within the body of a fragment. The head above was created within a fragment by using h4., followed by the head, followed by a blank line.

h4. Inserting heads

Creating lists

You can create non-numbered lists easily by prefixing each line with a star and a space, or a hash and a space for a numbered list – like so

* list item 1
* list item 2
** Nested list item under 2
* list item 3

# Ordered list
# Ordered list 2
# Ordered list 3

gives

  • list item 1
  • list item 2
    • Nested list item under 2
  • list item 3
  1. Ordered list
  2. Ordered list 2
  3. Ordered list 3

Creating links

See the Links page for details.

Other formatting

You can produce a wide variety of HTML using Textile, and it’s generally a lot easier than trying to write with HTML itself. For a fuller reference on textile formatting, see Textism or Textile Reference , or just do a search for formatting with textile.

Using Ruby

You can also insert eRuby into your fragments – please read the Ruby page for details.

A note on text file encoding

You should always save your text documents as UTF-8, to avoid problems with any foreign accents in the pages displaying incorrectly in browsers. If you use an application like Textmate it will save them in this format by default. If you use TextEdit or another editor, you can set the format it saves in by adjusting the Preferences for that editor.