Smark language-overview

Getting the Smark-Parser

The original Smark-Parser written in PHP can be seen using following link: Smark PHP-Parser. Instructions how to use the parser are included in this file, feel free to add Smark to your personal projects.

Inline formatting

Markup-Code Formatted Result
++inverse text++ inverse text
**bold text** bold text
__underlined text__ underlined text
--striked text-- striked text
^^supertext^^ supertext
~~subtext~~ subtext
??marked text?? marked text
@@<b>html-code</b>@@ html-code

Markup-Code Formatted Result
# Headline 1

Headline 1

## Headline 2

Headline 2

### Headline 3

Headline 3

#### Headline 4

Headline 4

##### Headline 5
Headline 5
###### Headline 6
Headline 6

Headline 1 Alternative Headline 1

Markup-Code Formatted Result
http://www.example.com http://www.example.com
Link [http://www.example.com::Example-Text] Example-Text
[![rootURL]!] set up a root-url for wiki-style-links
[[WikiStylePage]] WikiStylePage
[[WikiStylePage::Wiki Style Page]] Wiki Style Page
[^ AnchorID::Anchor Link Text] Anchor Link Text
[^ AnchorID] DesinationMarkup for Anchor-Link

Markup-Code Formatted Result
+quote+ Quote-Block +endquote+
+quote:By John Doe+ Quote-Block with Source +endquote+
By John DoeQuote-Block with Source
+code+ Code-Block +endcode+ Code-Block
+span+ Span-Element +endspan+ Span-Element
+div+ Div-Container +enddiv+
+para+ Paragraph +endpara+


Adding CSS-Styles, -Classes and -IDs to Block-Markup +quote|style="background-color:green;"+
+quote|class="myClass" id="myID"+

Quote with source and style
+quote:By John Doe|class="myClass"+ Quote-Block


Example :
:: term-1 : definition 1 : Definition 2
:: term-2
: Definition 1 for Term 2
: Definition 2 for Term 2
with an extra Line of Text
: Definition 3 for Term 2
:: term-3 : End definition-list with a blank line

Create Tables
Tables are enclosed with the +table+ +endtable+ markup.
The table head is enclosed with the +tablehead+ +endtablehead+ markup. Cells within this markup will be enclosed by the HTML-markup <thead>. Adding a table head to you tables is optional.
You can add a caption to your tables using the +caption
Your caption-text+ markup. This markup can placed anywhere in your table with the condition this markup need a sole line. Adding a caption to your table is optional.
Create normal cells
in normal formatting-mode for tables, write each cell in a single line in your text. To create a new row in your table, add a blank line between your cells.
by prepending a !! before your cells, the cell will be enclosed with the HTML-markup <th> instead of <td>

Example simple Smark-Table:
+caption:The caption of the table+
!! Line
first cell
second cell
!! First line
First normal cell first line
Second normal cell first line

!! Second line
First normal cell second line
Second normal cell second line

Adding styles, classes, ids to tables and cells
Adding styles, classes, ids to your cells works the same way it does for block-formatting.
+table|style="background-color: blue; color:yellow;"+
First Cell
Second cell

To add styles etc. to your cells, write those into the line before the actual line
First cell
Second Cell

colspan="2" style="background-color:white; color:black; text-align:center; font-weight:bold;"
Double cell

Normal cell
align="right" width="50%"
call with text-align\="right"

Compact table-formatting
Instead of using single lines for your cells, you have the option to use your own cell-separator. The markup: +table:[separator-sign]
When specifying a separator, the sign ; should be avoided when creating tables using words with special-characters like ä ö ü etc.. However, you can also use more complex separators like #-$-# to separate cells

first cell | second cell | third cell
!! first cell | !! second cell | !! third cell
style="background-color:red;" | first cell | style="background-color:blue" | second cell | style="background-color: green" | third cell

References Markup: ==The text displayed as Reference==. All references will be collected and can be displayed anywhere in your text using the markup: +showreferences+

Line-Breaks, Paragraphs Line-breaks and paragraphs are automatically generated. However you can place your own paragraph-blocks by using the +para+text+endpara+ markup. See Block-Formatting for more details

Entities Entities (special characters) will be automatically converted, no extra efforts neccessary

Escape-Characters Following Characters can be escaped with a prepending \ : \ * _ { } ( ) [ ] > # . ! + - : $ @ =
Example: * to escape the * symbol. Using escape you prevent Smark from parsing these very characters.

Block-Html-Escape The markup is : Your HTML-Code . All text between the markup won't be parsed.

Text-Comments Add a $-sign at the start of a line to comment it out. Subsequent lines will also be commented. To end a comment-block, insert a blank line.

HTML-Comment To add a HTML-Comment-Block use the markup: +comment+ text +endcomment+.

Deprecated Markup These markups still work, but are considered deprecated. Using those should be avoided.

Smark 1 Markup Smark 2 Markup
*****underlined, strong and inverted text***** Use __**++text++**__ instead
****strong and inverted text**** Use **++text**++ instead
***underlined text*** use __text__ instead
+color=green/white+text+endcolor+ use +span|style="color:green; background-color:white;"+test+endspan+ instead
[Display Text](http://www.example.con "Alt Text") use [http://www.example.con::Display Text] instead
some *inverse text* use ++text++ instead
+column+some text+endcolumn+ use +div|class="yourColumnClass"+some text+enddiv+ instead
+column:3+some text+endcolumn+ use +div|class="yourColumnClass"+some text+enddiv+ instead
+ref+Reference-Text+endref+ use ==Reference-Text== instead
[^ AnchorID (AnchorLinkTest)] use [^ AnchorID::AnchroLinkTest] instead