Smark language-overview
Getting the Smark-Parser
Current Version 1.0.6 (25.01.2019)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
- Headlines
- Headline 1 Alternative
- Links
- Media-Files
- Block-Formatting
- Lists
- Definition-Lists
- Tables
- References
- Line-Breaks, Paragraphs
- Entities
- Escape-Characters
- Block-Html-Escape
- Text-Comments
- HTML-Comment
- Deprecated Markup
Inline formatting
Markup-Code | Formatted Result |
---|---|
++inverse text++ | inverse text |
**bold text** | bold text |
__underlined text__ | underlined text |
--striked text-- | |
^^supertext^^ | supertext |
~~subtext~~ | subtext |
°°small text°° | small text |
??marked text?? | marked text |
@@html-code@@ | html-code |
--- |
Headlines
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==========
Links
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]] | Creates a Wiki-Style Link |
[[WikiStylePage::Wiki Style Page]] | Creates a named Wiki-Style Link |
[^ AnchorID::Anchor Link Text] | Creates the Anchor Link |
[^ AnchorID] | DesinationMarkup for Anchor-Link |
Media-Files
Image-, video- and audio-files will be recognized automatically, no additional markup is required to embed these files into your documents. Simply place the file-name (file-URL) where you want to display your media-file into your document. Following types are supported:Type | Extensions |
---|---|
Image | jpg, png, gif |
Video | mp4 |
Audio | mp3 |
Block-Formatting
Markup-Code | Formatted Result |
---|---|
+quote+ Quote-Block +endquote+ | Quote-Block |
+quote:By John Doe+ Quote-Block with Source +endquote+ | Quote-Block with Source |
+code+ Code-Block +endcode+ | Code-Block |
+span+ Span-Element +endspan+ | Span-Element |
+div+ Div-Container +enddiv+ | Div-Container |
+para+ Paragraph +endpara+ | Paragraph |
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
Lists
- unordered Lists start with a * or - or + followed by a space (* text)
- ordered lists starts with a number and a dot followed by a space (1. text)
- indent lists be prepending a tab before a list-item
- unordered and ordert lists can be mixed
Definition-Lists
- Definition-Lists start with :: followed by the term
- definitions are separated by a single :
- you can add as many definitions as you like
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
Tables
- Create Tables
- Tables are enclosed with the +table+ +endtable+ markup.
- Tablehead
- 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 your tables is optional.
- Tablefoot
- The table-foot is enclosed with the +tablefoot+ +endtablefoot+ markup. Cells within this markup will be enclosed by the HTML-markup <tfoot>. Adding a table-foot to your tables is optional.
- Tablebody
- The table-body is enclosed with the +tablebody+ +endtablebody+ markup. Cells within this markup will be enclosed by the HTML-markup <tbody>. Using the table-body-markup in your tables is optional and only necessary if you want an addional layer of style for your tables.
- Caption
- 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.
- <th>-cells
- By prepending a !! before your cells, the cell will be enclosed with the HTML-markup <th> instead of <td>
Example simple Smark-Table:
+table+
+caption:The caption of the table+
+tablehead+
!! Line
first cell
second cell
+endtablehead+
!! First line
First normal cell first line
Second normal cell first line
!! Second line
First normal cell second line
Second normal cell second line
+endtable+
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
+endtable+
To add styles etc. to your cells, write those into the line before the actual line
+table+
align="right"
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"
+endtable+
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
Example
+table:[|]+
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
+endtable+
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 detailsEntities
Entities (special characters) will be automatically converted, no extra efforts neccessaryEscape-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 : +html+ Your HTML-Code +endhtml+ . 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 |