Saturday, April 5, 2014

Markdown (and github markdown) Syntax

Markdown is a text-to-HTML conversion tool for web writers.

Markdown file extension is .md

You often see the file README.md in the root of github projects.

markdown syntax tips

Headers


# Header - level 1 #
## Header - level 2 ##
### Header - level 3 ###
(and so on)

Blockquote


> Quoted text

Code

Inline

Escape `inline code` with backticks

Github Fenced Code Blocks

Just wrap your code in ```

```
function test() {
  console.log("notice the blank line before this function?");
}
```

Github Language Syntax Highlighting


```ruby
require 'redcarpet'
markdown = Redcarpet.new("Hello World!")
puts markdown.to_html
```


We use Linguist to perform language detection and syntax highlighting. You can find out which keywords are valid by perusing the languages YAML file.

Tables

Simple Table


First Header  | Second Header
------------- | -------------
Content Cell  | Content Cell
Content Cell  | Content Cell

Table with Cell Alignment


| Left-Aligned  | Center Aligned  | Right Aligned |
| :------------ |:---------------:| -----:|
| col 3 is      | some wordy text | $1600 |
| col 2 is      | centered        |   $12 |
| zebra stripes | are neat        |    $1 |

Lists

Unordered Lists


* Use 
* The 
* Asterisk

Ordered Lists


1. Use
1. Number
1. Followed by Period

Horizontal Lines

Three or more dashes

---

Emphasis

Itialic


*italic*
**bold**

Escape Emphasis

Use backslash

not \*itialic\*
not \*\*bold\*\*

Github Striketrhough

Double squigly used to ~~strikethrough text~~

No comments:

Post a Comment