malt 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.rdoc +15 -1
- data/Syckfile +80 -0
- data/lib/malt.rb +1 -1
- data/lib/malt/config.rb +12 -0
- data/lib/malt/engines.rb +1 -1
- data/lib/malt/engines/abstract.rb +2 -2
- data/lib/malt/engines/bluecloth.rb +1 -1
- data/lib/malt/engines/erb.rb +1 -1
- data/lib/malt/engines/erubis.rb +1 -1
- data/lib/malt/engines/haml.rb +1 -1
- data/lib/malt/engines/kramdown.rb +1 -1
- data/lib/malt/engines/less.rb +1 -1
- data/lib/malt/engines/liquid.rb +1 -1
- data/lib/malt/engines/radius.rb +1 -1
- data/lib/malt/engines/rdiscount.rb +1 -1
- data/lib/malt/engines/rdoc.rb +1 -1
- data/lib/malt/engines/redcloth.rb +1 -1
- data/lib/malt/engines/rtals.rb +1 -1
- data/lib/malt/engines/ruby.rb +1 -1
- data/lib/malt/engines/sass.rb +1 -1
- data/lib/malt/engines/tenjin.rb +1 -1
- data/lib/malt/formats.rb +1 -1
- data/lib/malt/formats/abstract.rb +5 -3
- data/lib/malt/formats/abstract_template.rb +45 -0
- data/lib/malt/formats/css.rb +1 -1
- data/lib/malt/formats/erb.rb +3 -3
- data/lib/malt/formats/haml.rb +2 -2
- data/lib/malt/formats/html.rb +1 -1
- data/lib/malt/formats/latex.rb +1 -1
- data/lib/malt/formats/less.rb +2 -2
- data/lib/malt/formats/liquid.rb +2 -2
- data/lib/malt/formats/markdown.rb +4 -4
- data/lib/malt/formats/pdf.rb +1 -1
- data/lib/malt/formats/radius.rb +2 -2
- data/lib/malt/formats/rbhtml.rb +52 -0
- data/lib/malt/formats/rdoc.rb +2 -2
- data/lib/malt/formats/rhtml.rb +86 -0
- data/lib/malt/formats/rtals.rb +2 -2
- data/lib/malt/formats/ruby.rb +2 -2
- data/lib/malt/formats/sass.rb +2 -2
- data/lib/malt/formats/scss.rb +57 -0
- data/lib/malt/formats/tenjin.rb +2 -2
- data/lib/malt/formats/text.rb +1 -1
- data/lib/malt/formats/textile.rb +2 -2
- data/lib/malt/formats/yaml.rb +1 -1
- data/lib/malt/markup.rb +9 -0
- data/lib/malt/meta/gemfile +2 -2
- data/lib/malt/render.rb +65 -0
- data/lib/malt/template.rb +12 -0
- data/meta/gemfile +2 -2
- data/qed/01_overview.rdoc +6 -42
- data/qed/02_formats.rdoc +39 -0
- data/qed/03_formats/01_overview.rdoc +7 -0
- data/qed/03_formats/02_rdoc.rdoc +83 -0
- data/qed/03_formats/03_textile.rdoc +48 -0
- data/qed/03_formats/04_markdown.rdoc +66 -0
- data/qed/03_formats/05_erb.rdoc +65 -0
- data/qed/03_formats/06_liquid.rdoc +54 -0
- data/qed/03_formats/07_haml.rdoc +44 -0
- data/qed/03_formats/08_rtal.rdoc +15 -0
- data/qed/03_formats/09_radius.rdoc +43 -0
- data/qed/03_formats/11_tenjin.rdoc +47 -0
- data/qed/03_formats/12_rbhtml.rdoc +55 -0
- data/qed/03_formats/13_sass.rdoc +55 -0
- data/qed/03_formats/14_scss.rdoc +58 -0
- data/qed/03_formats/15_less.rdoc +46 -0
- data/qed/03_formats/16_ruby.rdoc +48 -0
- data/qed/samples/data.yml +4 -0
- data/qed/samples/output-erb.txt +1 -0
- data/qed/samples/output-liquid.txt +1 -0
- data/qed/samples/output-mustache.txt +1 -0
- data/qed/samples/output-radius.txt +1 -0
- data/qed/samples/sample.erb +1 -0
- data/qed/samples/sample.liquid +1 -0
- data/qed/samples/sample.mustache +1 -0
- data/qed/samples/sample.radius +1 -0
- data/test/samples/sample.md +308 -0
- data/test/samples/sample.rdoc +8 -0
- metadata +40 -4
@@ -0,0 +1,15 @@
|
|
1
|
+
== RTAL
|
2
|
+
|
3
|
+
Lets say we have a Rtals document called 'test.rtal' containing:
|
4
|
+
|
5
|
+
<h1>Example<span replace="title">DUMMY</span></h1>
|
6
|
+
<p>This is an example of a Rtals template.</p>
|
7
|
+
|
8
|
+
We can render Rtal documents via the +render+ method, as we can any format.
|
9
|
+
|
10
|
+
data = { :title=>"Document" }
|
11
|
+
|
12
|
+
html = Malt.render(:file=>'tmp/test.rtal', :data=>data)
|
13
|
+
|
14
|
+
html.assert.include?('<h1>Example <span>Document</span></h1>')
|
15
|
+
|
@@ -0,0 +1,43 @@
|
|
1
|
+
== Radius
|
2
|
+
|
3
|
+
Lets say we have a Radius document called 'test.radius' containing:
|
4
|
+
|
5
|
+
<h1>Example <r:title /></h1>
|
6
|
+
<p>This is an example of a Radius template.</p>
|
7
|
+
|
8
|
+
We can render Radius documents via the +render+ method, as we can any format.
|
9
|
+
|
10
|
+
data = {:title=>"Document"}
|
11
|
+
|
12
|
+
html = Malt.render(:file=>'tmp/test.radius', :data=>data, :tag_prefix=>'r')
|
13
|
+
|
14
|
+
html.assert.include?('<h1>Example Document</h1>')
|
15
|
+
|
16
|
+
We can get a hold of the Radius document via the Malt.file function.
|
17
|
+
|
18
|
+
radi = Malt.file('tmp/test.radius', :tag_prefix=>'r')
|
19
|
+
|
20
|
+
radi.class.assert == Malt::Format::Radius
|
21
|
+
|
22
|
+
Notice here we have passed an option to the file constructor. This option
|
23
|
+
is passed on the underlying Radius.new method. Now we can convert Radius
|
24
|
+
documents to HTML documents via #to_html.
|
25
|
+
|
26
|
+
data = {:title => "Document"}
|
27
|
+
|
28
|
+
html = radi.to_html(data)
|
29
|
+
|
30
|
+
First we will notice that the output is an instance of Malt::Format::HTML.
|
31
|
+
|
32
|
+
html.class.assert == Malt::Format::HTML
|
33
|
+
|
34
|
+
And that by calling #to_s we can get the rendered HTML document.
|
35
|
+
|
36
|
+
html.to_s.assert.include?('<h1>Example Document</h1>')
|
37
|
+
|
38
|
+
Or we can convert the Radius document directly to HTML via the #html method.
|
39
|
+
|
40
|
+
out = radi.html(data)
|
41
|
+
|
42
|
+
out.assert.include?('<h1>Example Document</h1>')
|
43
|
+
|
@@ -0,0 +1,47 @@
|
|
1
|
+
== Tenjin
|
2
|
+
|
3
|
+
While Tenjin is generally intended to be used to render HTML documents, it is
|
4
|
+
a general purpose template format that can be used for any type of document.
|
5
|
+
For these uses, the Tenjin file extension is '.tenjin'.
|
6
|
+
|
7
|
+
Lets say we have a Tenjin document called 'test.tenjin' containing:
|
8
|
+
|
9
|
+
Hello #{@name}!
|
10
|
+
|
11
|
+
We can render the document via #render.
|
12
|
+
|
13
|
+
data = { :name=>'World', :items=>['A','B','C'] }
|
14
|
+
|
15
|
+
@text = Malt.render(:file=>'tmp/test.tenjin', :data=>data)
|
16
|
+
|
17
|
+
And we can verify that @text is:
|
18
|
+
|
19
|
+
Hello World!
|
20
|
+
|
21
|
+
We can get a OOP interface tothe Tenjin document via the Malt.file function.
|
22
|
+
|
23
|
+
tenjin = Malt.file('tmp/test.tenjin')
|
24
|
+
|
25
|
+
tenjin.class.assert == Malt::Format::Tenjin
|
26
|
+
|
27
|
+
Since Tenjin is aa general pupose template foramt, we can convert Tenjin
|
28
|
+
documents to any format we wish. For instance we can convert our example
|
29
|
+
to a Text documents via #to_txt.
|
30
|
+
|
31
|
+
data = { :name=>'World', :items=>['<AAA>', 'B&B', '"CCC"'] }
|
32
|
+
|
33
|
+
text = tenjin.to_txt(data)
|
34
|
+
|
35
|
+
First we will notice that the output is an instance of `Malt::Format::Text`.
|
36
|
+
|
37
|
+
text.class.assert == Malt::Format::Text
|
38
|
+
|
39
|
+
And that by calling #to_s we can get the rendered Text document.
|
40
|
+
|
41
|
+
text.to_s.assert.include?('Hello World!')
|
42
|
+
|
43
|
+
Or we can convert the Tenjin document directly to text via the #txt method.
|
44
|
+
|
45
|
+
out = tenjin.txt(data)
|
46
|
+
|
47
|
+
out.assert.include?('Hello World!')
|
@@ -0,0 +1,55 @@
|
|
1
|
+
== RBHTML
|
2
|
+
|
3
|
+
Tenjin is a general purpose template language with support for multiple
|
4
|
+
languages including Ruby. The variation of Tenjin for Ruby, called rbTenjin,
|
5
|
+
defines a document format with an extension of `.rbhtml`.
|
6
|
+
|
7
|
+
Lets say we have a Tenjin document called 'test.rbhtml' containing:
|
8
|
+
|
9
|
+
Hello #{@name}!
|
10
|
+
<ul>
|
11
|
+
<?rb for item in @items ?>
|
12
|
+
<li>${item}</li>
|
13
|
+
<?rb end ?>
|
14
|
+
</ul>
|
15
|
+
|
16
|
+
We can render the document via #render.
|
17
|
+
|
18
|
+
data = { :name=>'World', :items=>['<AAA>', 'B&B', '"CCC"'] }
|
19
|
+
|
20
|
+
@html = Malt.render(:file=>'tmp/test.rbhtml', :data=>data)
|
21
|
+
|
22
|
+
And we can verify that @html is:
|
23
|
+
|
24
|
+
Hello World!
|
25
|
+
<ul>
|
26
|
+
<li><AAA></li>
|
27
|
+
<li>B&B</li>
|
28
|
+
<li>"CCC"</li>
|
29
|
+
</ul>
|
30
|
+
|
31
|
+
We can get a hold of the RBHTML document via the Malt.file function.
|
32
|
+
|
33
|
+
rbhtml = Malt.file('tmp/test.rbhtml')
|
34
|
+
|
35
|
+
rbhtml.class.assert == Malt::Format::RBHTML
|
36
|
+
|
37
|
+
We can convert RBHTML documents to HTML documents via #to_html.
|
38
|
+
|
39
|
+
data = { :name=>'World', :items=>['<AAA>', 'B&B', '"CCC"'] }
|
40
|
+
|
41
|
+
html = rbhtml.to_html(data)
|
42
|
+
|
43
|
+
First we will notice that the output is an instance of Malt::Format::HTML.
|
44
|
+
|
45
|
+
html.class.assert == Malt::Format::HTML
|
46
|
+
|
47
|
+
And that by calling #to_s we can get the rendered HTML document.
|
48
|
+
|
49
|
+
html.to_s.assert.include?('Hello World!')
|
50
|
+
|
51
|
+
Or we can convert the RBHTML document directly to HTML via the #html method.
|
52
|
+
|
53
|
+
out = rbhtml.html(data)
|
54
|
+
|
55
|
+
out.assert.include?('Hello World!')
|
@@ -0,0 +1,55 @@
|
|
1
|
+
== Sass
|
2
|
+
|
3
|
+
Lets say we have a Sass document called 'test.sass' containing:
|
4
|
+
|
5
|
+
$blue: #3bbfce
|
6
|
+
$margin: 16px
|
7
|
+
|
8
|
+
.content-navigation
|
9
|
+
border-color: $blue
|
10
|
+
color: darken($blue, 9%)
|
11
|
+
|
12
|
+
.border
|
13
|
+
padding: $margin / 2
|
14
|
+
margin: $margin / 2
|
15
|
+
border-color: $blue
|
16
|
+
|
17
|
+
We can render the Sass document via #render.
|
18
|
+
|
19
|
+
@css = Malt.render(:file=>'tmp/test.sass')
|
20
|
+
|
21
|
+
And we can verify that @css is the expected CSS:
|
22
|
+
|
23
|
+
.content-navigation {
|
24
|
+
border-color: #3bbfce;
|
25
|
+
color: #2ca2af; }
|
26
|
+
|
27
|
+
.border {
|
28
|
+
padding: 8px;
|
29
|
+
margin: 8px;
|
30
|
+
border-color: #3bbfce; }
|
31
|
+
|
32
|
+
We can also get a hold of the Sass document via the Malt.file function.
|
33
|
+
|
34
|
+
sass = Malt.file('tmp/test.sass')
|
35
|
+
|
36
|
+
sass.class.assert == Malt::Format::Sass
|
37
|
+
|
38
|
+
We can convert the Sass document to a CSS document via the #to_css method.
|
39
|
+
|
40
|
+
css = sass.to_css
|
41
|
+
|
42
|
+
We can see that the output is an instance of Malt::Format::HTML.
|
43
|
+
|
44
|
+
css.class.assert == Malt::Format::CSS
|
45
|
+
|
46
|
+
And that by calling #to_s we can get the rendered CSS document.
|
47
|
+
|
48
|
+
css.to_s.assert.include?('border-color: #3bbfce;')
|
49
|
+
|
50
|
+
Or we can convert the Sass document directly to CSS via the #css method.
|
51
|
+
|
52
|
+
out = sass.css
|
53
|
+
|
54
|
+
out.assert.include?('border-color: #3bbfce;')
|
55
|
+
|
@@ -0,0 +1,58 @@
|
|
1
|
+
== SCSS
|
2
|
+
|
3
|
+
Lets say we have a SCSS document called 'test.scss' containing:
|
4
|
+
|
5
|
+
$blue: #3bbfce;
|
6
|
+
$margin: 16px;
|
7
|
+
|
8
|
+
.content-navigation {
|
9
|
+
border-color: $blue;
|
10
|
+
color:
|
11
|
+
darken($blue, 9%);
|
12
|
+
}
|
13
|
+
|
14
|
+
.border {
|
15
|
+
padding: $margin / 2;
|
16
|
+
margin: $margin / 2;
|
17
|
+
border-color: $blue;
|
18
|
+
}
|
19
|
+
|
20
|
+
We can render the Sass document via #render.
|
21
|
+
|
22
|
+
@css = Malt.render(:file=>'tmp/test.scss')
|
23
|
+
|
24
|
+
And we can verify that @css is the expected CSS:
|
25
|
+
|
26
|
+
.content-navigation {
|
27
|
+
border-color: #3bbfce;
|
28
|
+
color: #2ca2af; }
|
29
|
+
|
30
|
+
.border {
|
31
|
+
padding: 8px;
|
32
|
+
margin: 8px;
|
33
|
+
border-color: #3bbfce; }
|
34
|
+
|
35
|
+
We can also get a hold of the SCSS document via the Malt.file function.
|
36
|
+
|
37
|
+
scss = Malt.file('tmp/test.scss')
|
38
|
+
|
39
|
+
scss.class.assert == Malt::Format::SCSS
|
40
|
+
|
41
|
+
We can convert the SCSS document to a CSS document via the #to_css method.
|
42
|
+
|
43
|
+
css = scss.to_css
|
44
|
+
|
45
|
+
We can see that the output is an instance of Malt::Format::SCSS.
|
46
|
+
|
47
|
+
css.class.assert == Malt::Format::CSS
|
48
|
+
|
49
|
+
And that by calling #to_s we can get the rendered CSS document.
|
50
|
+
|
51
|
+
css.to_s.assert.include?('border-color: #3bbfce;')
|
52
|
+
|
53
|
+
Or we can convert the SCSS document directly to CSS via the #css method.
|
54
|
+
|
55
|
+
out = scss.css
|
56
|
+
|
57
|
+
out.assert.include?('border-color: #3bbfce;')
|
58
|
+
|
@@ -0,0 +1,46 @@
|
|
1
|
+
== LESS
|
2
|
+
|
3
|
+
Lets say we have a LESS document called 'test.less' containing:
|
4
|
+
|
5
|
+
@brand_color: #4D926F;
|
6
|
+
#header {
|
7
|
+
color: @brand_color;
|
8
|
+
}
|
9
|
+
h2 {
|
10
|
+
color: @brand_color;
|
11
|
+
}
|
12
|
+
|
13
|
+
We can render it via Malt with #render.
|
14
|
+
|
15
|
+
@css = Malt.render(:file=>'tmp/test.less')
|
16
|
+
|
17
|
+
And we can verify that @css is:
|
18
|
+
|
19
|
+
#header, h2 { color: #4d926f; }
|
20
|
+
|
21
|
+
Look how concise that is. LESS is pretty slick.
|
22
|
+
|
23
|
+
We can also get a hold of the LESS document via the Malt.file function.
|
24
|
+
|
25
|
+
less = Malt.file('tmp/test.less')
|
26
|
+
|
27
|
+
less.class.assert == Malt::Format::LESS
|
28
|
+
|
29
|
+
We can convert the LESS document to a CSS document via the #to_css method.
|
30
|
+
|
31
|
+
css = less.to_css
|
32
|
+
|
33
|
+
We can see that the output is an instance of Malt::Format::HTML.
|
34
|
+
|
35
|
+
css.class.assert == Malt::Format::CSS
|
36
|
+
|
37
|
+
And that by calling #to_s we can get the rendered CSS document.
|
38
|
+
|
39
|
+
css.to_s.assert.include?('#header, h2 { color: #4d926f; }')
|
40
|
+
|
41
|
+
Or we can convert the LESS document directly to CSS via the #css method.
|
42
|
+
|
43
|
+
out = less.css
|
44
|
+
|
45
|
+
out.assert.include?('#header, h2 { color: #4d926f; }')
|
46
|
+
|
@@ -0,0 +1,48 @@
|
|
1
|
+
== Ruby
|
2
|
+
|
3
|
+
It may not seem obvious at first, but Ruby itself can be used as
|
4
|
+
a template system.
|
5
|
+
|
6
|
+
Lets say we have a Ruby document called 'test.rb' containing:
|
7
|
+
|
8
|
+
"<h1>Example #{ title }</h1>\n" +
|
9
|
+
"<p>This is an example of Ruby rendering.</p>"
|
10
|
+
|
11
|
+
We can run this Ruby script thru Malt's +render+ function.
|
12
|
+
|
13
|
+
data = {:title => 'Document'}
|
14
|
+
|
15
|
+
html = Malt.render(:file=>'tmp/test.rb', :data=>data)
|
16
|
+
|
17
|
+
Whatever was the final result of evaluating the Ruby script, converted to
|
18
|
+
a string via #to_s, will be the result of the rendering.
|
19
|
+
|
20
|
+
html.assert.include?('<h1>Example Document</h1>')
|
21
|
+
|
22
|
+
We can get a hold of the Ruby template via the Malt.file function.
|
23
|
+
|
24
|
+
ruby = Malt.file('tmp/test.rb')
|
25
|
+
|
26
|
+
ruby.class.assert == Malt::Format::Ruby
|
27
|
+
|
28
|
+
Ruby is a <i>universal template format</i>, so it can be converted to any other
|
29
|
+
format (even if it is not really that format).
|
30
|
+
|
31
|
+
data = {:title => "Document"}
|
32
|
+
|
33
|
+
html = ruby.to_html(data)
|
34
|
+
|
35
|
+
First we will notice that the output is an instance of Malt::Format::HTML.
|
36
|
+
|
37
|
+
html.class.assert == Malt::Format::HTML
|
38
|
+
|
39
|
+
And that by calling #to_s we can get the rendered HTML document.
|
40
|
+
|
41
|
+
html.to_s.assert.include?('<h1>Example Document</h1>')
|
42
|
+
|
43
|
+
Or we can convert the Ruby document directly to HTML via the #html method.
|
44
|
+
|
45
|
+
out = ruby.html(data)
|
46
|
+
|
47
|
+
out.assert.include?('<h1>Example Document</h1>')
|
48
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
Tom lives in Florida
|
@@ -0,0 +1 @@
|
|
1
|
+
Tom lives in Florida
|
@@ -0,0 +1 @@
|
|
1
|
+
Tom lives in Florida
|
@@ -0,0 +1 @@
|
|
1
|
+
Tom lives in Florida
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= name %> lives in <%= state %>
|
@@ -0,0 +1 @@
|
|
1
|
+
{{ name }} lives in {{ state }}
|
@@ -0,0 +1 @@
|
|
1
|
+
{{ name }} lives in {{ state }}
|
@@ -0,0 +1 @@
|
|
1
|
+
<r:name /> lives in <r:state />
|
@@ -0,0 +1,308 @@
|
|
1
|
+
Markdown: Basics
|
2
|
+
================
|
3
|
+
|
4
|
+
<ul id="ProjectSubmenu">
|
5
|
+
<li><a href="/projects/markdown/" title="Markdown Project Page">Main</a></li>
|
6
|
+
<li><a class="selected" title="Markdown Basics">Basics</a></li>
|
7
|
+
<li><a href="/projects/markdown/syntax" title="Markdown Syntax Documentation">Syntax</a></li>
|
8
|
+
<li><a href="/projects/markdown/license" title="Pricing and License Information">License</a></li>
|
9
|
+
<li><a href="/projects/markdown/dingus" title="Online Markdown Web Form">Dingus</a></li>
|
10
|
+
</ul>
|
11
|
+
|
12
|
+
|
13
|
+
Getting the Gist of Markdown's Formatting Syntax
|
14
|
+
------------------------------------------------
|
15
|
+
|
16
|
+
This page offers a brief overview of what it's like to use Markdown.
|
17
|
+
The [syntax page] [s] provides complete, detailed documentation for
|
18
|
+
every feature, but Markdown should be very easy to pick up simply by
|
19
|
+
looking at a few examples of it in action. The examples on this page
|
20
|
+
are written in a before/after style, showing example syntax and the
|
21
|
+
HTML output produced by Markdown.
|
22
|
+
|
23
|
+
It's also helpful to simply try Markdown out; the [Dingus] [d] is a
|
24
|
+
web application that allows you type your own Markdown-formatted text
|
25
|
+
and translate it to XHTML.
|
26
|
+
|
27
|
+
**Note:** This document is itself written using Markdown; you
|
28
|
+
can [see the source for it by adding '.text' to the URL] [src].
|
29
|
+
|
30
|
+
[s]: /projects/markdown/syntax "Markdown Syntax"
|
31
|
+
[d]: /projects/markdown/dingus "Markdown Dingus"
|
32
|
+
[src]: /projects/markdown/basics.text
|
33
|
+
|
34
|
+
|
35
|
+
## Paragraphs, Headers, Blockquotes ##
|
36
|
+
|
37
|
+
A paragraph is simply one or more consecutive lines of text, separated
|
38
|
+
by one or more blank lines. (A blank line is any line that looks like
|
39
|
+
a blank line -- a line containing nothing but spaces or tabs is
|
40
|
+
considered blank.) Normal paragraphs should not be indented with
|
41
|
+
spaces or tabs.
|
42
|
+
|
43
|
+
Markdown offers two styles of headers: *Setext* and *atx*.
|
44
|
+
Setext-style headers for `<h1>` and `<h2>` are created by
|
45
|
+
"underlining" with equal signs (`=`) and hyphens (`-`), respectively.
|
46
|
+
To create an atx-style header, you put 1-6 hash marks (`#`) at the
|
47
|
+
beginning of the line -- the number of hashes equals the resulting
|
48
|
+
HTML header level.
|
49
|
+
|
50
|
+
Blockquotes are indicated using email-style '`>`' angle brackets.
|
51
|
+
|
52
|
+
Markdown:
|
53
|
+
|
54
|
+
A First Level Header
|
55
|
+
====================
|
56
|
+
|
57
|
+
A Second Level Header
|
58
|
+
---------------------
|
59
|
+
|
60
|
+
Now is the time for all good men to come to
|
61
|
+
the aid of their country. This is just a
|
62
|
+
regular paragraph.
|
63
|
+
|
64
|
+
The quick brown fox jumped over the lazy
|
65
|
+
dog's back.
|
66
|
+
|
67
|
+
### Header 3
|
68
|
+
|
69
|
+
> This is a blockquote.
|
70
|
+
>
|
71
|
+
> This is the second paragraph in the blockquote.
|
72
|
+
>
|
73
|
+
> ## This is an H2 in a blockquote
|
74
|
+
|
75
|
+
|
76
|
+
Output:
|
77
|
+
|
78
|
+
<h1>A First Level Header</h1>
|
79
|
+
|
80
|
+
<h2>A Second Level Header</h2>
|
81
|
+
|
82
|
+
<p>Now is the time for all good men to come to
|
83
|
+
the aid of their country. This is just a
|
84
|
+
regular paragraph.</p>
|
85
|
+
|
86
|
+
<p>The quick brown fox jumped over the lazy
|
87
|
+
dog's back.</p>
|
88
|
+
|
89
|
+
<h3>Header 3</h3>
|
90
|
+
|
91
|
+
<blockquote>
|
92
|
+
<p>This is a blockquote.</p>
|
93
|
+
|
94
|
+
<p>This is the second paragraph in the blockquote.</p>
|
95
|
+
|
96
|
+
<h2>This is an H2 in a blockquote</h2>
|
97
|
+
</blockquote>
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
### Phrase Emphasis ###
|
102
|
+
|
103
|
+
Markdown uses asterisks and underscores to indicate spans of emphasis.
|
104
|
+
|
105
|
+
Markdown:
|
106
|
+
|
107
|
+
Some of these words *are emphasized*.
|
108
|
+
Some of these words _are emphasized also_.
|
109
|
+
|
110
|
+
Use two asterisks for **strong emphasis**.
|
111
|
+
Or, if you prefer, __use two underscores instead__.
|
112
|
+
|
113
|
+
Output:
|
114
|
+
|
115
|
+
<p>Some of these words <em>are emphasized</em>.
|
116
|
+
Some of these words <em>are emphasized also</em>.</p>
|
117
|
+
|
118
|
+
<p>Use two asterisks for <strong>strong emphasis</strong>.
|
119
|
+
Or, if you prefer, <strong>use two underscores instead</strong>.</p>
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
## Lists ##
|
124
|
+
|
125
|
+
Unordered (bulleted) lists use asterisks, pluses, and hyphens (`*`,
|
126
|
+
`+`, and `-`) as list markers. These three markers are
|
127
|
+
interchangable; this:
|
128
|
+
|
129
|
+
* Candy.
|
130
|
+
* Gum.
|
131
|
+
* Booze.
|
132
|
+
|
133
|
+
this:
|
134
|
+
|
135
|
+
+ Candy.
|
136
|
+
+ Gum.
|
137
|
+
+ Booze.
|
138
|
+
|
139
|
+
and this:
|
140
|
+
|
141
|
+
- Candy.
|
142
|
+
- Gum.
|
143
|
+
- Booze.
|
144
|
+
|
145
|
+
all produce the same output:
|
146
|
+
|
147
|
+
<ul>
|
148
|
+
<li>Candy.</li>
|
149
|
+
<li>Gum.</li>
|
150
|
+
<li>Booze.</li>
|
151
|
+
</ul>
|
152
|
+
|
153
|
+
Ordered (numbered) lists use regular numbers, followed by periods, as
|
154
|
+
list markers:
|
155
|
+
|
156
|
+
1. Red
|
157
|
+
2. Green
|
158
|
+
3. Blue
|
159
|
+
|
160
|
+
Output:
|
161
|
+
|
162
|
+
<ol>
|
163
|
+
<li>Red</li>
|
164
|
+
<li>Green</li>
|
165
|
+
<li>Blue</li>
|
166
|
+
</ol>
|
167
|
+
|
168
|
+
If you put blank lines between items, you'll get `<p>` tags for the
|
169
|
+
list item text. You can create multi-paragraph list items by indenting
|
170
|
+
the paragraphs by 4 spaces or 1 tab:
|
171
|
+
|
172
|
+
* A list item.
|
173
|
+
|
174
|
+
With multiple paragraphs.
|
175
|
+
|
176
|
+
* Another item in the list.
|
177
|
+
|
178
|
+
Output:
|
179
|
+
|
180
|
+
<ul>
|
181
|
+
<li><p>A list item.</p>
|
182
|
+
<p>With multiple paragraphs.</p></li>
|
183
|
+
<li><p>Another item in the list.</p></li>
|
184
|
+
</ul>
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
### Links ###
|
189
|
+
|
190
|
+
Markdown supports two styles for creating links: *inline* and
|
191
|
+
*reference*. With both styles, you use square brackets to delimit the
|
192
|
+
text you want to turn into a link.
|
193
|
+
|
194
|
+
Inline-style links use parentheses immediately after the link text.
|
195
|
+
For example:
|
196
|
+
|
197
|
+
This is an [example link](http://example.com/).
|
198
|
+
|
199
|
+
Output:
|
200
|
+
|
201
|
+
<p>This is an <a href="http://example.com/">
|
202
|
+
example link</a>.</p>
|
203
|
+
|
204
|
+
Optionally, you may include a title attribute in the parentheses:
|
205
|
+
|
206
|
+
This is an [example link](http://example.com/ "With a Title").
|
207
|
+
|
208
|
+
Output:
|
209
|
+
|
210
|
+
<p>This is an <a href="http://example.com/" title="With a Title">
|
211
|
+
example link</a>.</p>
|
212
|
+
|
213
|
+
Reference-style links allow you to refer to your links by names, which
|
214
|
+
you define elsewhere in your document:
|
215
|
+
|
216
|
+
I get 10 times more traffic from [Google][1] than from
|
217
|
+
[Yahoo][2] or [MSN][3].
|
218
|
+
|
219
|
+
[1]: http://google.com/ "Google"
|
220
|
+
[2]: http://search.yahoo.com/ "Yahoo Search"
|
221
|
+
[3]: http://search.msn.com/ "MSN Search"
|
222
|
+
|
223
|
+
Output:
|
224
|
+
|
225
|
+
<p>I get 10 times more traffic from <a href="http://google.com/"
|
226
|
+
title="Google">Google</a> than from <a href="http://search.yahoo.com/"
|
227
|
+
title="Yahoo Search">Yahoo</a> or <a href="http://search.msn.com/"
|
228
|
+
title="MSN Search">MSN</a>.</p>
|
229
|
+
|
230
|
+
The title attribute is optional. Link names may contain letters,
|
231
|
+
numbers and spaces, but are *not* case sensitive:
|
232
|
+
|
233
|
+
I start my morning with a cup of coffee and
|
234
|
+
[The New York Times][NY Times].
|
235
|
+
|
236
|
+
[ny times]: http://www.nytimes.com/
|
237
|
+
|
238
|
+
Output:
|
239
|
+
|
240
|
+
<p>I start my morning with a cup of coffee and
|
241
|
+
<a href="http://www.nytimes.com/">The New York Times</a>.</p>
|
242
|
+
|
243
|
+
|
244
|
+
### Images ###
|
245
|
+
|
246
|
+
Image syntax is very much like link syntax.
|
247
|
+
|
248
|
+
Inline (titles are optional):
|
249
|
+
|
250
|
+
![alt text](/path/to/img.jpg "Title")
|
251
|
+
|
252
|
+
Reference-style:
|
253
|
+
|
254
|
+
![alt text][id]
|
255
|
+
|
256
|
+
[id]: /path/to/img.jpg "Title"
|
257
|
+
|
258
|
+
Both of the above examples produce the same output:
|
259
|
+
|
260
|
+
<img src="/path/to/img.jpg" alt="alt text" title="Title" />
|
261
|
+
|
262
|
+
|
263
|
+
|
264
|
+
### Code ###
|
265
|
+
|
266
|
+
In a regular paragraph, you can create code span by wrapping text in
|
267
|
+
backtick quotes. Any ampersands (`&`) and angle brackets (`<` or
|
268
|
+
`>`) will automatically be translated into HTML entities. This makes
|
269
|
+
it easy to use Markdown to write about HTML example code:
|
270
|
+
|
271
|
+
I strongly recommend against using any `<blink>` tags.
|
272
|
+
|
273
|
+
I wish SmartyPants used named entities like `—`
|
274
|
+
instead of decimal-encoded entites like `—`.
|
275
|
+
|
276
|
+
Output:
|
277
|
+
|
278
|
+
<p>I strongly recommend against using any
|
279
|
+
<code><blink></code> tags.</p>
|
280
|
+
|
281
|
+
<p>I wish SmartyPants used named entities like
|
282
|
+
<code>&mdash;</code> instead of decimal-encoded
|
283
|
+
entites like <code>&#8212;</code>.</p>
|
284
|
+
|
285
|
+
|
286
|
+
To specify an entire block of pre-formatted code, indent every line of
|
287
|
+
the block by 4 spaces or 1 tab. Just like with code spans, `&`, `<`,
|
288
|
+
and `>` characters will be escaped automatically.
|
289
|
+
|
290
|
+
Markdown:
|
291
|
+
|
292
|
+
If you want your page to validate under XHTML 1.0 Strict,
|
293
|
+
you've got to put paragraph tags in your blockquotes:
|
294
|
+
|
295
|
+
<blockquote>
|
296
|
+
<p>For example.</p>
|
297
|
+
</blockquote>
|
298
|
+
|
299
|
+
Output:
|
300
|
+
|
301
|
+
<p>If you want your page to validate under XHTML 1.0 Strict,
|
302
|
+
you've got to put paragraph tags in your blockquotes:</p>
|
303
|
+
|
304
|
+
<pre><code><blockquote>
|
305
|
+
<p>For example.</p>
|
306
|
+
</blockquote>
|
307
|
+
</code></pre>
|
308
|
+
|