Wiki Cheatsheet

18.1.2016 19:05

Wiki Cheat Sheet

Andrei Mantsivoda

Оглавление

The Libretto library com/teacode/wiki is based on the Markdown syntax.

Markdown

Paragraphs

  • A paragraph is one or more consecutive lines of text separated by one or more blank lines.

First paragraph

Second paragraph

  • Manual line breaks: start a line with two spaces:

Hey Jude, don't make it bad
  Take a sad song and make it better
  Remember to let her into your heart
  Then you can start to make it better

Hey Jude, don't make it bad
Take a sad song and make it better
Remember to let her into your heart
Then you can start to make it better


Headings

Setext style:

# Heading 1
## Heading 2
######* Heading 6
The asterisk * immediately after '#'s in the last example means that the specified header should not be enumerated and included in the table of contents.

Heading 1

Heading 2 # #

Heading 6

Atx style:

Heading 1
=========

Heading 2
----

Heading 1

Heading 2


Emphasis and Importance

Emphasis: *example* or _example_
Importance: **example** or __example__
Emphasis + Importance __*example*__ or **_example_**
Emphasis: example or example
Importance: example or example
Emphasis + Importance example or example


Numbered lists

1. Ordered list item
2. Ordered list item
5. Ordered list item

  1. Ordered list item
  2. Ordered list item
  3. Ordered list item

The list starts with its first number:

5. Ordered list item
1. Ordered list item
1. Ordered list item

  1. Ordered list item
  2. Ordered list item
  3. Ordered list item


Bulleted lists

* Bulleted list item
+ Bulleted list item
- Bulleted list item

  • Bulleted list item
  • Bulleted list item
  • Bulleted list item


Nesting lists

* First level
 * Second level

  • First level

    • Second level

1. First level
  * Second level
    1. Third level

  1. First level

    • Second level

      1. Third level


Blockquote

A blockquote starts with '>' at the first position of the line:

> This is a blockquote

  • This is a blockquote

  • Links

    • Normal link
      [TeaCode link](http://teacode.com) TeaCode link

    • Reference link
      [TeaCode link][teacode]
      [teacode]: http://teacode.com

      TeaCode link


    Images

    ![Alt text](http://hd.wallpaperswide.com/thumbs/boat_at_sea-t2.jpg)

    ![Fig1. Beautiful forest][forest]
    
    ![forest]: http://www.mnn.com/sites/default/files/styles/featured_blog/public/forest_7.jpg
    width=500px
    

    Fig1. Beautiful forest


    Internal Cross-References

    You can include an optional label to a header for automated handling internal links in your document.

    For instance, you can have

        ## Internal Cross-References #[crossref]
    
    and then use [cross-references](#crossref) to organize the link. This is what you obtain:

  • cross-references
  • Code

    • Inline code is marked by a single or double tick ` :

      This is the code: `def Int add1: Int! = this + 1`

      This is the code: def Int add1: Int! = this + 1

    • Block code is marked by triple tick ``` at the line start with the optional hint for a highlighter:

       ``` libretto
       def helloWorld = this.hello + this.world
       def hello = "Hello, "
       def world = "World" + this
       ```
    


    Horizontal rules

    Three or more asterisks (*), hyphens (-) or underscores (_) optionally separated by spaces

    ** ** ** **

    The rule must be preceded by the empty line. Here is the result:


    Escaping formatting characters

    \\ \` \* \_ \[ \] \{ \} \( \) \# \+ \- \. \! \|


    Embedded HTML

    This is an HTML insertion: <span style="color: purple; font-size:200%">Hello, World!</span>

    This is an HTML insertion: Hello, World!


    HTML Character Entity References

    Here are some math symbols: &nabla; &empty; &notin; &asymp;

    Here are some math symbols: ∇ ∅ ∉ ≈

    Numeric character references also can be used: &#x398; &#931; &#x03A9;

    Numeric character references also can be used: Θ Σ Ω.


    MultiMarkdown +

    Multimarkdown is an extention of Markdown, which allows you to create tables, bibliography lists, footnotes etc. In Libretto Wiki a number of features of Multimarkdown are implemented – plus some additional tools (like Blocks)

    Bibliography

    This is the first reference ~[p.300][ref1] and this is the second one ~[][ref2].
    
    ~[ref1]: Malykh, A., Mantsivoda. A Query Language for Logic Architectures.
    Lecture Notes in Computer Science 5947, 2010, pp.294–305.
    
    ~[ref2]: Doe, J. Another paper. Some journal.
    
    This is the first reference [1, p.300] and this is the second one [2].

    Section Bibliography Lists explains how to insert a bibliography list into the document.


    Footnotes

    To create a footnote, use the following pattern:

    Here is a text with a footnote.^[][somefootnote]
    

    Here is a text with a footnote.[1]


    The pattern of a footnote itself:

    ^[somefootnote]: Here is the text of the footnote itself.
    

    To show the footnotes in the document we should insert the footnote list. In section Footnote list it is shown how to insert footnote lists in the document.


    Tables

    A table with two header rows and several multispan cells

    [Table 1. Important data]
    |             |          Grouping           ||
    First Header  | Second Header | Third Header 
     ------------ | :-----------: | -----------: |
    Content       |          *Long Cell*        ||
    
    Content       |   **Cell**    |         Cell 
    New section   |     More      |         Data |
    And more      | With an escaped '\|'        ||
    

    is represented as

    Table 1. Important data
    Grouping
    First Header Second Header Third Header
    Content Long Cell
    Content Cell Cell
    New section More Data
    And more With an escaped '|'


    Local Links

    Local links allow you to handle links between wiki documents within some resource, e.g. a site. There are two syntax patterns for local links – on-spot links and reference links.

    On-spot links:

    *[local link text](local link)
    
    Reference links:

    *[local link text][linkID]
    ....
    *[linkID]: local link description
    

    This is the example of a reference link:

    *[tryit]: /1439809207551/1439809207551!pic/1439811645092!text
    
    This is how the link itself organized:
    *[try it!][tryit]
    

    It is converted into:

    try it!

    Here /1439809207551/1439809207551!pic/1439811645092!text is a local local link.

    The technique of local links allows you to establish internal connections within the collection of independent wiki documents. The Libretto library com/teacode/wiki supports special tools for this.


    Insertions

    In LibrettoWiki you can insert a locally accessible document into another document.

    This is an on-spot insertion:

    +[comment](local Link)
    

    This is a reference insertion:

    +[comment][insId]
    
    +[InsId]: local link description
    

    For instance:

    +[Math symbols in LaTeX](1432401322703)
    
    The text in square brackets is a comment.


    Math

    Inline math formulas in the TeX format:

    \\(\int_0^\infty e^{-x^2} dx=\frac{\sqrt{\pi}}{2}\\)
    

    \(\int_0^\infty e^{-x^2} dx=\frac{\sqrt{\pi}}{2}\)


    The block formulas:

    \\[\begin{eqnarray}
     y & =   & x^4 + 4         \\
       & =   & (x^2+2)^2 -4x^2 \\
       & \le & (x^2+2)^2
    \end{eqnarray}\\]
    

    \[\begin{eqnarray} y &=& x^4 + 4 \\ &=& (x^2+2)^2 -4x^2 \\ &\le&(x^2+2)^2 \end{eqnarray}\]


    Comments

    In Libretto Wiki you can insert invisible comments starting with the triple %%%

    %%% This is a comment
    


    Meta Data

    Special comments are used for defining metadata in the key/value form, e.g.

    %%%> age: 15
    
    Metadata are recognized by '>' typed immediately after '%'s.

    Note that keys are case-insensitive, so

    %%%> name: Andrei
    
    and
    %%%> NaMe: Andrei
    
    are not distinguishable.

    You can define arbitrary metadata, but some can be used by the methods. E.g. the following keys are used for generating the document title (see section Insertions):

    • title is the title of the whole document. This key is also used to determine the title of the generated HTML document.
    • author is the document's author
    • affiliation specifies the affiliation of the author
    • address defines the address
    • date sets the date of the document
    • email sets the relevant email address.

    Multiple entries of the keys are legal, e.g.

    %%%> author: Andrei Mantsivoda
    %%%> author: Olga Romanova
    %%%> affiliation: Irkutsk state university
    %%%> affiliation: Libretto Labs
    

    • css specifies a CSS stylesheets for wiki-text rendering:

    %%%> css: /wikipaper.css
    
    Multiple entries of css are also possible. All CSS stylesheets will be included in the HTML document in the order they are specified in the metadata.


    Insertions

    Title

    In case of multiple entries of the same key you can handle the order, in which the components appear in the title. For instance, the following insertion

    %%%! TTL title author affiliation author affiliation
    
    first prints the title, then the first author with the first affiliation, and finally the second author with the second affiliation. Note that here we use singulars instead of plural words.


    Table of Contents

    Type this to include the table of contents:

    %%%! TOC
    
    If you do not want to include all levels of headers, just impose the restriction:
    %%%! TOC 3
    
    Here only headers from h1 to h3 will be included in the table.


    Bibliography Lists

    Use

    %%%! BIB
    
    to insert the bibliography list. It will comprise all references in order they are included in the document. This is the bibliography list of our cheat sheet:

    [1] Malykh, A., Mantsivoda. A Query Language for Logic Architectures. Lecture Notes in Computer Science 5947, 2010, pp.294–305.

    [2] Doe, J. Another paper. Some journal.

    (these references were declared in section Bibliography).


    Footnote Lists

    Use

    %%%! FTN
    
    to insert the list of footnotes. If we insert this to our documentation, we'll have:

    [1] Here is the text of the footnote itself.

    This list consists of one footnote specified in section Footnotes:

    ***

    Blocks

    Blocks are used to create visually emphasized text blocks – like theorems, examples, remarks etc. This function is similar to that of the LaTeX's 'theorem' environment. For instance,

    &[Remark] The Wirth's law is 
      > "Software is getting slower more rapidly than hardware becomes faster."
    
    To specify a block use [@blockname] at the first position of the line. The result is:

    Remark 1.  The Wirth's law is

  • "Software is getting slower more rapidly than hardware becomes faster."
  • The layout of blocks is regulated by CSS. For instance, they can look exactly like theorems in LaTeX:

    &[Theorem] The following logic formulas are valid:
      * \\(P \supset Q \equiv (\neg Q) \supset (\neg P).\\)
      * \\(P \supset Q \not \equiv Q \supset P.\\)
    

    Theorem 2.  The following logic formulas are valid:

    • \(P \supset Q \equiv (\neg Q) \supset (\neg P).\)
    • \(P \supset Q \not \equiv Q \supset P.\)

    The 'Remark' and 'Theorem' blocks differ only by their CSS declarations. All blocks belong to the CSS class markdownthm, and their headers belong to the class markdownthm-header. Appending block names to the names of these classes allows you to handle specific blocks. For instance, the block 'Theorem' has the following CSS description:

    .markdownthm-Theorem {
      background: white;
      padding: 0px 0px 0px 0px;
      margin: 20px 0px 20px 0px;
      font-family: Times;
      font-style: italic;
      border: 0;
    }
    

    By default Libretto Wiki provides the sequential numbering of blocks. You can use '*' to supress numbering:

    &[Remark]* Cats are hard to hurdle.
    

    Remark.  Cats are hard to hurdle.

    Use a single space as a block's name to create 'anonymous' blocks:

    &[ ]* A fool thinks himself to be wise, but a wise man knows himself to be a fool.
      **William Shakespeare**
    

    Now,

    A fool thinks himself to be wise, but a wise man knows himself to be a fool.
    William Shakespeare




    © Libretto Labs, 2015