asciidoctor 1.5.2 → 1.5.3
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of asciidoctor might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.adoc +107 -1
- data/LICENSE.adoc +1 -1
- data/README.adoc +155 -230
- data/Rakefile +2 -1
- data/bin/asciidoctor +5 -1
- data/data/stylesheets/asciidoctor-default.css +37 -29
- data/data/stylesheets/coderay-asciidoctor.css +3 -3
- data/features/text_formatting.feature +2 -0
- data/lib/asciidoctor.rb +46 -21
- data/lib/asciidoctor/abstract_block.rb +14 -8
- data/lib/asciidoctor/abstract_node.rb +77 -24
- data/lib/asciidoctor/attribute_list.rb +1 -1
- data/lib/asciidoctor/block.rb +2 -3
- data/lib/asciidoctor/cli/options.rb +14 -15
- data/lib/asciidoctor/converter/docbook45.rb +8 -8
- data/lib/asciidoctor/converter/docbook5.rb +25 -17
- data/lib/asciidoctor/converter/factory.rb +6 -1
- data/lib/asciidoctor/converter/html5.rb +159 -117
- data/lib/asciidoctor/converter/manpage.rb +671 -0
- data/lib/asciidoctor/converter/template.rb +24 -17
- data/lib/asciidoctor/document.rb +89 -47
- data/lib/asciidoctor/extensions.rb +22 -21
- data/lib/asciidoctor/helpers.rb +73 -16
- data/lib/asciidoctor/list.rb +26 -5
- data/lib/asciidoctor/parser.rb +179 -122
- data/lib/asciidoctor/path_resolver.rb +6 -10
- data/lib/asciidoctor/reader.rb +37 -34
- data/lib/asciidoctor/stylesheets.rb +16 -10
- data/lib/asciidoctor/substitutors.rb +98 -21
- data/lib/asciidoctor/table.rb +21 -17
- data/lib/asciidoctor/timings.rb +3 -3
- data/lib/asciidoctor/version.rb +1 -1
- data/man/asciidoctor.1 +155 -89
- data/man/asciidoctor.adoc +19 -11
- data/test/attributes_test.rb +86 -0
- data/test/blocks_test.rb +203 -15
- data/test/converter_test.rb +15 -2
- data/test/document_test.rb +290 -36
- data/test/extensions_test.rb +22 -3
- data/test/fixtures/circle.svg +8 -0
- data/test/fixtures/subs-docinfo.html +2 -0
- data/test/fixtures/subs.adoc +7 -0
- data/test/invoker_test.rb +25 -0
- data/test/links_test.rb +17 -0
- data/test/lists_test.rb +173 -0
- data/test/options_test.rb +2 -2
- data/test/paragraphs_test.rb +2 -2
- data/test/parser_test.rb +56 -13
- data/test/reader_test.rb +35 -3
- data/test/sections_test.rb +59 -0
- data/test/substitutions_test.rb +53 -14
- data/test/tables_test.rb +158 -2
- data/test/test_helper.rb +7 -2
- metadata +22 -11
- data/benchmark/benchmark.rb +0 -129
- data/benchmark/sample-data/mdbasics.adoc +0 -334
- data/lib/asciidoctor/opal_ext.rb +0 -26
- data/lib/asciidoctor/opal_ext/comparable.rb +0 -38
- data/lib/asciidoctor/opal_ext/dir.rb +0 -13
- data/lib/asciidoctor/opal_ext/error.rb +0 -2
- data/lib/asciidoctor/opal_ext/file.rb +0 -145
data/test/test_helper.rb
CHANGED
@@ -10,7 +10,12 @@ require 'simplecov' if ENV['COVERAGE'] == 'true'
|
|
10
10
|
|
11
11
|
require File.join(ASCIIDOCTOR_PROJECT_DIR, 'lib', 'asciidoctor')
|
12
12
|
|
13
|
-
require
|
13
|
+
# NOTE we require minitest libraries explicitly to avoid a superfluous warning
|
14
|
+
require 'minitest/unit'
|
15
|
+
require 'minitest/spec'
|
16
|
+
require 'minitest/mock'
|
17
|
+
MiniTest::Unit.autorun
|
18
|
+
|
14
19
|
require 'socket'
|
15
20
|
require 'nokogiri'
|
16
21
|
require 'tmpdir'
|
@@ -180,7 +185,7 @@ class Minitest::Test
|
|
180
185
|
else
|
181
186
|
# this is required because nokogiri is ignorant
|
182
187
|
result = document_from_string(src, opts).render
|
183
|
-
result = result.sub(RE_XMLNS_ATTRIBUTE, '')
|
188
|
+
result = result.sub(RE_XMLNS_ATTRIBUTE, '') if result
|
184
189
|
result
|
185
190
|
end
|
186
191
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: asciidoctor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Allen
|
@@ -13,8 +13,22 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date:
|
16
|
+
date: 2015-10-31 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
|
+
- !ruby/object:Gem::Dependency
|
19
|
+
name: asciimath
|
20
|
+
requirement: !ruby/object:Gem::Requirement
|
21
|
+
requirements:
|
22
|
+
- - "~>"
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: 1.0.1
|
25
|
+
type: :development
|
26
|
+
prerelease: false
|
27
|
+
version_requirements: !ruby/object:Gem::Requirement
|
28
|
+
requirements:
|
29
|
+
- - "~>"
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: 1.0.1
|
18
32
|
- !ruby/object:Gem::Dependency
|
19
33
|
name: coderay
|
20
34
|
requirement: !ruby/object:Gem::Requirement
|
@@ -212,8 +226,6 @@ files:
|
|
212
226
|
- LICENSE.adoc
|
213
227
|
- README.adoc
|
214
228
|
- Rakefile
|
215
|
-
- benchmark/benchmark.rb
|
216
|
-
- benchmark/sample-data/mdbasics.adoc
|
217
229
|
- bin/asciidoctor
|
218
230
|
- bin/asciidoctor-safe
|
219
231
|
- compat/asciidoc.conf
|
@@ -241,6 +253,7 @@ files:
|
|
241
253
|
- lib/asciidoctor/converter/docbook5.rb
|
242
254
|
- lib/asciidoctor/converter/factory.rb
|
243
255
|
- lib/asciidoctor/converter/html5.rb
|
256
|
+
- lib/asciidoctor/converter/manpage.rb
|
244
257
|
- lib/asciidoctor/converter/template.rb
|
245
258
|
- lib/asciidoctor/core_ext.rb
|
246
259
|
- lib/asciidoctor/core_ext/object/nil_or_empty.rb
|
@@ -251,11 +264,6 @@ files:
|
|
251
264
|
- lib/asciidoctor/helpers.rb
|
252
265
|
- lib/asciidoctor/inline.rb
|
253
266
|
- lib/asciidoctor/list.rb
|
254
|
-
- lib/asciidoctor/opal_ext.rb
|
255
|
-
- lib/asciidoctor/opal_ext/comparable.rb
|
256
|
-
- lib/asciidoctor/opal_ext/dir.rb
|
257
|
-
- lib/asciidoctor/opal_ext/error.rb
|
258
|
-
- lib/asciidoctor/opal_ext/file.rb
|
259
267
|
- lib/asciidoctor/parser.rb
|
260
268
|
- lib/asciidoctor/path_resolver.rb
|
261
269
|
- lib/asciidoctor/reader.rb
|
@@ -280,6 +288,7 @@ files:
|
|
280
288
|
- test/fixtures/basic.asciidoc
|
281
289
|
- test/fixtures/chapter-a.adoc
|
282
290
|
- test/fixtures/child-include.adoc
|
291
|
+
- test/fixtures/circle.svg
|
283
292
|
- test/fixtures/custom-backends/erb/html5/block_paragraph.html.erb
|
284
293
|
- test/fixtures/custom-backends/haml/docbook45/block_paragraph.xml.haml
|
285
294
|
- test/fixtures/custom-backends/haml/html5-tweaks/block_paragraph.html.haml
|
@@ -305,6 +314,8 @@ files:
|
|
305
314
|
- test/fixtures/parent-include.adoc
|
306
315
|
- test/fixtures/sample.asciidoc
|
307
316
|
- test/fixtures/stylesheets/custom.css
|
317
|
+
- test/fixtures/subs-docinfo.html
|
318
|
+
- test/fixtures/subs.adoc
|
308
319
|
- test/fixtures/tip.gif
|
309
320
|
- test/invoker_test.rb
|
310
321
|
- test/links_test.rb
|
@@ -340,8 +351,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
340
351
|
- !ruby/object:Gem::Version
|
341
352
|
version: '0'
|
342
353
|
requirements: []
|
343
|
-
rubyforge_project:
|
344
|
-
rubygems_version: 2.
|
354
|
+
rubyforge_project:
|
355
|
+
rubygems_version: 2.4.8
|
345
356
|
signing_key:
|
346
357
|
specification_version: 4
|
347
358
|
summary: An implementation of the AsciiDoc text processor and publishing toolchain
|
data/benchmark/benchmark.rb
DELETED
@@ -1,129 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
=begin
|
4
|
-
|
5
|
-
Use this script to monitor changes in performance when making code changes to Asciidoctor.
|
6
|
-
|
7
|
-
$ ruby benchmark.rb <benchmark-name> <repeat>
|
8
|
-
|
9
|
-
The most common benchmark is the userguide-loop.
|
10
|
-
It will download the AsciiDoc User Guide automatically the first time, then convert it in memory.
|
11
|
-
Running it 10 times provides a good picture.
|
12
|
-
|
13
|
-
$ ruby benchmark.rb userguide-loop 10
|
14
|
-
|
15
|
-
Only worry about the relative change to the numbers before and after the code change.
|
16
|
-
Absolute times are highly dependent on the capabilities of the machine the the version of Ruby.
|
17
|
-
|
18
|
-
To get the best results under MRI, tune Ruby using environment variables as follows:
|
19
|
-
|
20
|
-
.Ruby < 2.1
|
21
|
-
$ RUBY_GC_MALLOC_LIMIT=90000000 RUBY_FREE_MIN=650000 ruby benchmark.rb userguide-loop 10
|
22
|
-
|
23
|
-
.Ruby >= 2.1
|
24
|
-
$ RUBY_GC_MALLOC_LIMIT=128000000 RUBY_GC_OLDMALLOC_LIMIT=128000000 RUBY_GC_HEAP_INIT_SLOTS=800000 RUBY_GC_HEAP_FREE_SLOTS=800000 RUBY_GC_HEAP_GROWTH_MAX_SLOTS=250000 RUBY_GC_HEAP_GROWTH_FACTOR=2 ruby benchmark.rb userguide-loop 10
|
25
|
-
|
26
|
-
Asciidoctor starts with ~ 12,500 objects, adds ~ 300,000 each run, so tune RUBY_GC_HEAP_* accordingly
|
27
|
-
|
28
|
-
See http://globaldev.co.uk/2014/05/ruby-2-1-in-detail/#gc-tuning-environment-variables
|
29
|
-
|
30
|
-
Execute Ruby using the `--disable=gems` flag to speed up the initial load time, as shown below:
|
31
|
-
|
32
|
-
$ ruby --disable=gems ...
|
33
|
-
|
34
|
-
=end
|
35
|
-
|
36
|
-
require 'benchmark'
|
37
|
-
include Benchmark
|
38
|
-
|
39
|
-
bench = ARGV[0]
|
40
|
-
$repeat = ARGV[1].to_i || 10000
|
41
|
-
|
42
|
-
if bench.nil?
|
43
|
-
raise 'You must specify a benchmark to run.'
|
44
|
-
end
|
45
|
-
|
46
|
-
def fetch_userguide
|
47
|
-
require 'open-uri'
|
48
|
-
userguide_uri = 'https://raw.githubusercontent.com/asciidoc/asciidoc/d43faae38c4a8bf366dcba545971da99f2b2d625/doc/asciidoc.txt'
|
49
|
-
customers_uri = 'https://raw.githubusercontent.com/asciidoc/asciidoc/d43faae38c4a8bf366dcba545971da99f2b2d625/doc/customers.csv'
|
50
|
-
userguide_content = open(userguide_uri) {|fd2| fd2.read }
|
51
|
-
customers_content = open(customers_uri) {|fd2| fd2.read }
|
52
|
-
File.open('sample-data/userguide.adoc', 'w') {|fd1| fd1.write userguide_content }
|
53
|
-
File.open('sample-data/customers.csv', 'w') {|fd1| fd1.write customers_content }
|
54
|
-
end
|
55
|
-
|
56
|
-
case bench
|
57
|
-
|
58
|
-
=begin
|
59
|
-
# benchmark template
|
60
|
-
|
61
|
-
when 'name'
|
62
|
-
|
63
|
-
sample = 'value'
|
64
|
-
|
65
|
-
Benchmark.bmbm(12) {|bm|
|
66
|
-
bm.report('operation a') { $repeat.times { call_a_on sample } }
|
67
|
-
bm.report('operation b') { $repeat.times { call_b_on sample } }
|
68
|
-
}
|
69
|
-
=end
|
70
|
-
|
71
|
-
when 'userguide'
|
72
|
-
require '../lib/asciidoctor.rb'
|
73
|
-
Asciidoctor::Compliance.markdown_syntax = false
|
74
|
-
Asciidoctor::Compliance.shorthand_property_syntax = false if Asciidoctor::VERSION > '0.1.4'
|
75
|
-
sample_file = ENV['BENCH_TEST_FILE'] || 'sample-data/userguide.adoc'
|
76
|
-
backend = ENV['BENCH_BACKEND'] || 'html5'
|
77
|
-
fetch_userguide if sample_file == 'sample-data/userguide.adoc' && !(File.exist? sample_file)
|
78
|
-
result = Benchmark.bmbm {|bm|
|
79
|
-
bm.report(%(Convert #{sample_file} (x#{$repeat}))) {
|
80
|
-
$repeat.times {
|
81
|
-
Asciidoctor.render_file sample_file, :backend => backend, :safe => Asciidoctor::SafeMode::SAFE, :eruby => 'erubis', :header_footer => true, :to_file => false, :attributes => {'linkcss' => '', 'toc' => nil, 'numbered' => nil, 'icons' => nil, 'compat-mode' => 'legacy'}
|
82
|
-
}
|
83
|
-
}
|
84
|
-
}
|
85
|
-
# prints average for real run
|
86
|
-
puts %(>avg: #{result.first.real / $repeat})
|
87
|
-
|
88
|
-
when 'userguide-loop'
|
89
|
-
require '../lib/asciidoctor.rb'
|
90
|
-
GC.start
|
91
|
-
Asciidoctor::Compliance.markdown_syntax = false
|
92
|
-
Asciidoctor::Compliance.shorthand_property_syntax = false if Asciidoctor::VERSION > '0.1.4'
|
93
|
-
sample_file = ENV['BENCH_TEST_FILE'] || 'sample-data/userguide.adoc'
|
94
|
-
backend = ENV['BENCH_BACKEND'] || 'html5'
|
95
|
-
fetch_userguide if sample_file == 'sample-data/userguide.adoc' && !(File.exist? sample_file)
|
96
|
-
|
97
|
-
best = nil
|
98
|
-
2.times.each do
|
99
|
-
outer_start = Time.now
|
100
|
-
(1..$repeat).each do
|
101
|
-
inner_start = Time.now
|
102
|
-
Asciidoctor.render_file sample_file, :backend => backend, :safe => Asciidoctor::SafeMode::SAFE, :eruby => 'erubis', :header_footer => true, :to_file => false, :attributes => {'linkcss' => '', 'toc' => nil, 'numbered' => nil, 'icons' => nil, 'compat-mode' => 'legacy'}
|
103
|
-
puts (elapsed = Time.now - inner_start)
|
104
|
-
best = (best ? [best, elapsed].min : elapsed)
|
105
|
-
end
|
106
|
-
puts %(Run Total: #{Time.now - outer_start})
|
107
|
-
end
|
108
|
-
puts %(Best Time: #{best})
|
109
|
-
|
110
|
-
when 'mdbasics-loop'
|
111
|
-
require '../lib/asciidoctor.rb'
|
112
|
-
GC.start
|
113
|
-
sample_file = ENV['BENCH_TEST_FILE'] || 'sample-data/userguide.adoc'
|
114
|
-
backend = ENV['BENCH_BACKEND'] || 'html5'
|
115
|
-
|
116
|
-
best = nil
|
117
|
-
2.times do
|
118
|
-
outer_start = Time.now
|
119
|
-
(1..$repeat).each do
|
120
|
-
inner_start = Time.now
|
121
|
-
Asciidoctor.render_file sample_file, :backend => backend, :safe => Asciidoctor::SafeMode::SAFE, :header_footer => false, :to_file => false, :attributes => {'linkcss' => '', 'idprefix' => '', 'idseparator' => '-', 'showtitle' => ''}
|
122
|
-
puts (elapsed = Time.now - inner_start)
|
123
|
-
best = (best ? [best, elapsed].min : elapsed)
|
124
|
-
end
|
125
|
-
puts %(Run Total: #{Time.now - outer_start})
|
126
|
-
end
|
127
|
-
puts %(Best Time: #{best})
|
128
|
-
|
129
|
-
end
|
@@ -1,334 +0,0 @@
|
|
1
|
-
// converted to AsciiDoc from https://github.com/gettalong/kramdown/blob/master/benchmark/mdbasics.text
|
2
|
-
# Markdown: Basics
|
3
|
-
John Gruber
|
4
|
-
:s: link:/projects/markdown/syntax
|
5
|
-
:d: link:/projects/markdown/dingus
|
6
|
-
:src: link:/projects/markdown/basics.text
|
7
|
-
|
8
|
-
++++
|
9
|
-
<ul id="ProjectSubmenu">
|
10
|
-
<li><a href="/projects/markdown/" title="Markdown Project Page">Main</a></li>
|
11
|
-
<li><a class="selected" title="Markdown Basics">Basics</a></li>
|
12
|
-
<li><a href="/projects/markdown/syntax" title="Markdown Syntax Documentation">Syntax</a></li>
|
13
|
-
<li><a href="/projects/markdown/license" title="Pricing and License Information">License</a></li>
|
14
|
-
<li><a href="/projects/markdown/dingus" title="Online Markdown Web Form">Dingus</a></li>
|
15
|
-
</ul>
|
16
|
-
++++
|
17
|
-
|
18
|
-
## Getting the Gist of Markdown's Formatting Syntax
|
19
|
-
|
20
|
-
This page offers a brief overview of what it's like to use Markdown.
|
21
|
-
The {s}[syntax page] provides complete, detailed documentation for
|
22
|
-
every feature, but Markdown should be very easy to pick up simply by
|
23
|
-
looking at a few examples of it in action. The examples on this page
|
24
|
-
are written in a before/after style, showing example syntax and the
|
25
|
-
HTML output produced by Markdown.
|
26
|
-
|
27
|
-
It's also helpful to simply try Markdown out; the {d}[Dingus] is a
|
28
|
-
web application that allows you type your own Markdown-formatted text
|
29
|
-
and translate it to XHTML.
|
30
|
-
|
31
|
-
NOTE: This document is itself written using Markdown; you
|
32
|
-
can {src}[see the source for it by adding \'.text' to the URL].
|
33
|
-
|
34
|
-
### Paragraphs, Headers, Blockquotes
|
35
|
-
|
36
|
-
A paragraph is simply one or more consecutive lines of text, separated
|
37
|
-
by one or more blank lines. (A blank line is any line that looks like a
|
38
|
-
blank line -- a line containing nothing spaces or tabs is considered
|
39
|
-
blank.) Normal paragraphs should not be intended with spaces or tabs.
|
40
|
-
|
41
|
-
Markdown offers two styles of headers: _Setext_ and _atx_.
|
42
|
-
Setext-style headers for +<h1>+ and +<h2>+ are created by
|
43
|
-
"underlining" with equal signs (+=+) and hyphens (+-+), respectively.
|
44
|
-
To create an atx-style header, you put 1-6 hash marks (+#+) at the
|
45
|
-
beginning of the line -- the number of hashes equals the resulting
|
46
|
-
HTML header level.
|
47
|
-
|
48
|
-
Blockquotes are indicated using email-style \'+>+' angle brackets.
|
49
|
-
|
50
|
-
.Markdown:
|
51
|
-
[listing]
|
52
|
-
....
|
53
|
-
A First Level Header
|
54
|
-
====================
|
55
|
-
|
56
|
-
A Second Level Header
|
57
|
-
---------------------
|
58
|
-
|
59
|
-
Now is the time for all good men to come to
|
60
|
-
the aid of their country. This is just a
|
61
|
-
regular paragraph.
|
62
|
-
|
63
|
-
The quick brown fox jumped over the lazy
|
64
|
-
dog's back.
|
65
|
-
|
66
|
-
### Header 3
|
67
|
-
|
68
|
-
> This is a blockquote.
|
69
|
-
>
|
70
|
-
> This is the second paragraph in the blockquote.
|
71
|
-
>
|
72
|
-
> ## This is an H2 in a blockquote
|
73
|
-
....
|
74
|
-
|
75
|
-
.Output:
|
76
|
-
....
|
77
|
-
<h1>A First Level Header</h1>
|
78
|
-
|
79
|
-
<h2>A Second Level Header</h2>
|
80
|
-
|
81
|
-
<p>Now is the time for all good men to come to
|
82
|
-
the aid of their country. This is just a
|
83
|
-
regular paragraph.</p>
|
84
|
-
|
85
|
-
<p>The quick brown fox jumped over the lazy
|
86
|
-
dog's back.</p>
|
87
|
-
|
88
|
-
<h3>Header 3</h3>
|
89
|
-
|
90
|
-
<blockquote>
|
91
|
-
<p>This is a blockquote.</p>
|
92
|
-
|
93
|
-
<p>This is the second paragraph in the blockquote.</p>
|
94
|
-
|
95
|
-
<h2>This is an H2 in a blockquote</h2>
|
96
|
-
</blockquote>
|
97
|
-
....
|
98
|
-
|
99
|
-
### Phrase Emphasis
|
100
|
-
|
101
|
-
Markdown uses asterisks and underscores to indicate spans of emphasis.
|
102
|
-
|
103
|
-
.Markdown:
|
104
|
-
----
|
105
|
-
Some of these words *are emphasized*.
|
106
|
-
Some of these words _are emphasized also_.
|
107
|
-
|
108
|
-
Use two asterisks for **strong emphasis**.
|
109
|
-
Or, if you prefer, __use two underscores instead__.
|
110
|
-
----
|
111
|
-
|
112
|
-
.Output:
|
113
|
-
....
|
114
|
-
<p>Some of these words <em>are emphasized</em>.
|
115
|
-
Some of these words <em>are emphasized also</em>.</p>
|
116
|
-
|
117
|
-
<p>Use two asterisks for <strong>strong emphasis</strong>.
|
118
|
-
Or, if you prefer, <strong>use two underscores instead</strong>.</p>
|
119
|
-
....
|
120
|
-
|
121
|
-
### Lists
|
122
|
-
|
123
|
-
Unordered (bulleted) lists use asterisks, pluses, and hyphens (+*+,
|
124
|
-
+++, and +-+) as list markers. These three markers are
|
125
|
-
interchangable; this:
|
126
|
-
|
127
|
-
----
|
128
|
-
* Candy.
|
129
|
-
* Gum.
|
130
|
-
* Booze.
|
131
|
-
----
|
132
|
-
|
133
|
-
this:
|
134
|
-
|
135
|
-
----
|
136
|
-
+ Candy.
|
137
|
-
+ Gum.
|
138
|
-
+ Booze.
|
139
|
-
----
|
140
|
-
|
141
|
-
and this:
|
142
|
-
|
143
|
-
----
|
144
|
-
- Candy.
|
145
|
-
- Gum.
|
146
|
-
- Booze.
|
147
|
-
----
|
148
|
-
|
149
|
-
all produce the same output:
|
150
|
-
|
151
|
-
....
|
152
|
-
<ul>
|
153
|
-
<li>Candy.</li>
|
154
|
-
<li>Gum.</li>
|
155
|
-
<li>Booze.</li>
|
156
|
-
</ul>
|
157
|
-
....
|
158
|
-
|
159
|
-
Ordered (numbered) lists use regular numbers, followed by periods, as
|
160
|
-
list markers:
|
161
|
-
|
162
|
-
----
|
163
|
-
1. Red
|
164
|
-
2. Green
|
165
|
-
3. Blue
|
166
|
-
----
|
167
|
-
|
168
|
-
.Output:
|
169
|
-
....
|
170
|
-
<ol>
|
171
|
-
<li>Red</li>
|
172
|
-
<li>Green</li>
|
173
|
-
<li>Blue</li>
|
174
|
-
</ol>
|
175
|
-
....
|
176
|
-
|
177
|
-
If you put blank lines between items, you'll get +<p>+ tags for the
|
178
|
-
list item text. You can create multi-paragraph list items by indenting
|
179
|
-
the paragraphs by 4 spaces or 1 tab:
|
180
|
-
|
181
|
-
----
|
182
|
-
* A list item.
|
183
|
-
|
184
|
-
With multiple paragraphs.
|
185
|
-
|
186
|
-
* Another item in the list.
|
187
|
-
----
|
188
|
-
|
189
|
-
.Output:
|
190
|
-
....
|
191
|
-
<ul>
|
192
|
-
<li><p>A list item.</p>
|
193
|
-
<p>With multiple paragraphs.</p></li>
|
194
|
-
<li><p>Another item in the list.</p></li>
|
195
|
-
</ul>
|
196
|
-
....
|
197
|
-
|
198
|
-
### Links
|
199
|
-
|
200
|
-
Markdown supports two styles for creating links: _inline_ and
|
201
|
-
_reference_. With both styles, you use square brackets to delimit the
|
202
|
-
text you want to turn into a link.
|
203
|
-
|
204
|
-
Inline-style links use parentheses immediately after the link text.
|
205
|
-
For example:
|
206
|
-
|
207
|
-
----
|
208
|
-
This is an [example link](http://example.com/).
|
209
|
-
----
|
210
|
-
|
211
|
-
.Output:
|
212
|
-
....
|
213
|
-
<p>This is an <a href="http://example.com/">
|
214
|
-
example link</a>.</p>
|
215
|
-
....
|
216
|
-
|
217
|
-
Optionally, you may include a title attribute in the parentheses:
|
218
|
-
|
219
|
-
----
|
220
|
-
This is an [example link](http://example.com/ "With a Title").
|
221
|
-
----
|
222
|
-
|
223
|
-
.Output:
|
224
|
-
....
|
225
|
-
<p>This is an <a href="http://example.com/" title="With a Title">
|
226
|
-
example link</a>.</p>
|
227
|
-
....
|
228
|
-
|
229
|
-
Reference-style links allow you to refer to your links by names, which
|
230
|
-
you define elsewhere in your document:
|
231
|
-
|
232
|
-
----
|
233
|
-
I get 10 times more traffic from [Google][1] than from
|
234
|
-
[Yahoo][2] or [MSN][3].
|
235
|
-
|
236
|
-
[1]: http://google.com/ "Google"
|
237
|
-
[2]: http://search.yahoo.com/ "Yahoo Search"
|
238
|
-
[3]: http://search.msn.com/ "MSN Search"
|
239
|
-
----
|
240
|
-
|
241
|
-
.Output:
|
242
|
-
....
|
243
|
-
<p>I get 10 times more traffic from <a href="http://google.com/"
|
244
|
-
title="Google">Google</a> than from <a href="http://search.yahoo.com/"
|
245
|
-
title="Yahoo Search">Yahoo</a> or <a href="http://search.msn.com/"
|
246
|
-
title="MSN Search">MSN</a>.</p>
|
247
|
-
....
|
248
|
-
|
249
|
-
The title attribute is optional. Link names may contain letters,
|
250
|
-
numbers and spaces, but are _not_ case sensitive:
|
251
|
-
|
252
|
-
----
|
253
|
-
I start my morning with a cup of coffee and
|
254
|
-
[The New York Times][NY Times].
|
255
|
-
|
256
|
-
[ny times]: http://www.nytimes.com/
|
257
|
-
----
|
258
|
-
|
259
|
-
.Output:
|
260
|
-
....
|
261
|
-
<p>I start my morning with a cup of coffee and
|
262
|
-
<a href="http://www.nytimes.com/">The New York Times</a>.</p>
|
263
|
-
....
|
264
|
-
|
265
|
-
### Images
|
266
|
-
|
267
|
-
Image syntax is very much like link syntax.
|
268
|
-
|
269
|
-
.Inline (titles are optional):
|
270
|
-
----
|
271
|
-
![alt text](/path/to/img.jpg "Title")
|
272
|
-
----
|
273
|
-
|
274
|
-
.Reference-style:
|
275
|
-
----
|
276
|
-
![alt text][id]
|
277
|
-
|
278
|
-
[id]: /path/to/img.jpg "Title"
|
279
|
-
----
|
280
|
-
|
281
|
-
Both of the above examples produce the same output:
|
282
|
-
|
283
|
-
....
|
284
|
-
<img src="/path/to/img.jpg" alt="alt text" title="Title" />
|
285
|
-
....
|
286
|
-
|
287
|
-
### Code
|
288
|
-
|
289
|
-
In a regular paragraph, you can create code span by wrapping text in
|
290
|
-
backtick quotes. Any ampersands (+&+) and angle brackets (+<+ or
|
291
|
-
+>+) will automatically be translated into HTML entities. This makes
|
292
|
-
it easy to use Markdown to write about HTML example code:
|
293
|
-
|
294
|
-
----
|
295
|
-
I strongly recommend against using any `<blink>` tags.
|
296
|
-
|
297
|
-
I wish SmartyPants used named entities like `—`
|
298
|
-
instead of decimal-encoded entites like `—`.
|
299
|
-
----
|
300
|
-
|
301
|
-
.Output:
|
302
|
-
....
|
303
|
-
<p>I strongly recommend against using any
|
304
|
-
<code><blink></code> tags.</p>
|
305
|
-
|
306
|
-
<p>I wish SmartyPants used named entities like
|
307
|
-
<code>&mdash;</code> instead of decimal-encoded
|
308
|
-
entites like <code>&#8212;</code>.</p>
|
309
|
-
....
|
310
|
-
|
311
|
-
To specify an entire block of pre-formatted code, indent every line of
|
312
|
-
the block by 4 spaces or 1 tab. Just like with code spans, +&+, +<+,
|
313
|
-
and +>+ characters will be escaped automatically.
|
314
|
-
|
315
|
-
.Markdown:
|
316
|
-
----
|
317
|
-
If you want your page to validate under XHTML 1.0 Strict,
|
318
|
-
you've got to put paragraph tags in your blockquotes:
|
319
|
-
|
320
|
-
<blockquote>
|
321
|
-
<p>For example.</p>
|
322
|
-
</blockquote>
|
323
|
-
----
|
324
|
-
|
325
|
-
.Output:
|
326
|
-
....
|
327
|
-
<p>If you want your page to validate under XHTML 1.0 Strict,
|
328
|
-
you've got to put paragraph tags in your blockquotes:</p>
|
329
|
-
|
330
|
-
<pre><code><blockquote>
|
331
|
-
<p>For example.</p>
|
332
|
-
</blockquote>
|
333
|
-
</code></pre>
|
334
|
-
....
|