Forum syntax for text decoration cheatsheet

If (like me) you have difficulties to make your text look nice in this forum, well here is the solution: you have to use ‘markdown language’ (thanks to Andrew Stacey for explaining this) and here a cheat sheet i copied and edited from wikipedia:

  1. The text you have to write
  2. The result

####Headings
HTML headings are produced by placing a number of hashes before the header text corresponding to the level of heading desired (HTML offers six levels of headings), like so:   
## second level
### third
#### Fourth-level heading. 
(i removed 1rst level because it uses too much space). 
####Paragraphs. 
A paragraph is one or more consecutive lines of text separated by one or more blank lines. Normal paragraphs should not be indented with spaces or tabs:  
This is a paragraph. It has two sentences.

This is another paragraph. It also has 
two sentences.
####Lists.  
* An item in a bulleted (unordered) list
    * A subitem, indented with 4 spaces
* Another item in a bulleted list.    

Remark: this works correctly only if there is a separtor like a title or line break before and after the list

1. An item in an enumerated (ordered) list
2. Another item in an enumerated list. 
1. A third item showing that the actual numbers are irrelevant.
####Line return. 
Line breaks inserted in the text are removed from the final result: the web browser is in charge of breaking lines depending on the available space. To force a line break, insert two spaces at the end of the line.  
####Emphasized text
*emphasis* or _emphasis_  (e.g., italics). 
**strong emphasis** or __strong emphasis__ (e.g., boldface).    
Note: does not work if you leave spaces between text and the * or _
####Code
To include code (formatted in monospace font), you can either surround inline code with backticks like in: Some text with `some code` inside,  
or surround your code by  3 tildes: 
~~ (note: I put only 2 here but it should be 3).  
line 1 of code. 
line 2 of code. 
line 3 of code.  
~~
The latter option makes Markdown retain all whitespace—as opposed to the usual behaviour, which, by removing line breaks and excess spaces, would break indentation and code layout.

(Note that there is a small bug here: the first line of code gains an extra space.)
####Line Breaks
When you do want to insert a break tag using Markdown, you end a line with two or more spaces, then type return. For example:  
def show_results. 
tag_br space space. 
end. 
####Blockquotes
> "This entire paragraph of text will be enclosed in an HTML blockquote element.
Blockquote elements are reflowable. You may arbitrarily
wrap the text to your liking, and it will all be parsed
into a single blockquote element.".  
####Links
Links may be included inline:   
[link text here](link.address.here).  
#### Horizontal rules
Horizontal rules are created by placing three or more hyphens, asterisks, or underscores on a line by themselves. You may use spaces between the hyphens or asterisks. Each of the following lines will produce a horizontal rule:
* * *
***
*****
- - -
#### Embedding a video
Just paste the youtube link:
htt://www.youtube.com/watch?v=YJeWGcavtlI

(the above link is deliberately mangled to avoid the automatic inclusion which also occurs in code blocks)
#### Tables
| Item      | Value |
| --------- | -----|
| Computer  | $1600 |
| Phone     |   $12 |
| Pipe      |    $1 |

Alignment is handled by putting a colon at one or both (for centred columns) end of the second row (the one with the dashes)

#### embeding an image
This is almost the same as the link syntax but it has an exclamation mark at the start.  The link text becomes the title text (useful for screen readers or text browsers):
![A picture of the earth](http://www.jmv38.net23.net/images/earthDay.jpg)

####Headings
HTML headings are produced by placing a number of hashes before the header text corresponding to the level of heading desired (HTML offers six levels of headings), like so:

second level

third

Fourth-level heading.

(i removed 1rst level because it uses too much space).
####Paragraphs.
A paragraph is one or more consecutive lines of text separated by one or more blank lines. Normal paragraphs should not be indented with spaces or tabs:
This is a paragraph. It has two sentences.

This is another paragraph. It also has
two sentences.
####Lists.

  • An item in a bulleted (unordered) list
    • A subitem, indented with 4 spaces
  • Another item in a bulleted list.

Remark: this works correctly only if there is a separtor like a title or line break before and after the list

  1. An item in an enumerated (ordered) list
  2. Another item in an enumerated list.
  3. A third item showing that the actual numbers are irrelevant.
    ####Line return.
    Line breaks inserted in the text are removed from the final result: the web browser is in charge of breaking lines depending on the available space. To force a line break, insert two spaces at the end of the line.
    ####Emphasized text
    emphasis or emphasis (e.g., italics).
    strong emphasis or strong emphasis (e.g., boldface).
    Note: does not work if you leave spaces between text and the * or _
    ####Code
    To include code (formatted in monospace font), you can either surround inline code with backticks like in: Some text with some code inside,
    or surround your code by 3 tildes:
line 1 of code. 
line 2 of code. 
line 3 of code.  

The latter option makes Markdown retain all whitespace—as opposed to the usual behaviour, which, by removing line breaks and excess spaces, would break indentation and code layout.

(Note that there is a small bug here: the first line of code gains an extra space.)
####Line Breaks
When you do want to insert a break tag using Markdown, you end a line with two or more spaces, then type return. For example:
def show_results.
tag_br space space.
end.
####Blockquotes

“This entire paragraph of text will be enclosed in an HTML blockquote element.
Blockquote elements are reflowable. You may arbitrarily
wrap the text to your liking, and it will all be parsed
into a single blockquote element.”.
####Links
Links may be included inline:
link text here.

Horizontal rules

Horizontal rules are created by placing three or more hyphens, asterisks, or underscores on a line by themselves. You may use spaces between the hyphens or asterisks. Each of the following lines will produce a horizontal rule:





Embedding a video

Just paste the youtube link:

Tables

Item Value
Computer $1600
Phone $12
Pipe $1

Alignment is handled by putting a colon at one or both (for centred columns) end of the second row (the one with the dashes)

embeding an image

This is almost the same as the link syntax but it has an exclamation mark at the start. The link text becomes the title text (useful for screen readers or text browsers):
A picture of the earth

.@Andrew_Stacey thanks for having added some more useful info to the above post.

I believe that, at least for short pieces of code, some syntax highlighting can be achieved by surrounding the code with pre tags with the lang attribute set to lua. For example (I hope, the syntax highlighting is not displayed when you ‘preview’):

function greet()
    print("Hello, World!")
end

```


My experience is that with longer code, the displayed code can be truncated if syntax highlighting is used.

This comment aims to set out the text that produces the result above. I have had problems including a pre tag in a code block without having to escape the special characters:

<pre lang="lua">
function greet()
    print("Hello, World!")
end


Hopefully, this attempt will have worked.

tes
t
attempt
at markdown

--this is a test

```

.@Simeon i know you’re quite busy with other things (1.5…) but i was wondering wether the right place for this cheatsheet would be in the wiki?

.@Jmv38 there’s a section called “About the Codea Forums” which has a section on formatting comments. Your cheat sheet could be integrated into there.

Side note: (IMHO) an easier way to make a line break rather than two spaces (which leaves a period) is to use the <br> tag.

It<br>works like<br>this.

It
works like
this.


You can also have an return after it, so it looks a bit more natural to human eyes.

This is some<br>
text with a line break.

This is some

text with a line break.

P.S. Sorry to bring up an old topic, but I wanted to point this out…