kramdown 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of kramdown might be problematic. Click here for more details.
- data/ChangeLog +346 -0
- data/Rakefile +36 -29
- data/VERSION +1 -1
- data/benchmark/testing.sh +1 -1
- data/bin/kramdown +0 -4
- data/doc/index.page +1 -1
- data/doc/links.markdown +4 -0
- data/doc/news.page +2 -1
- data/doc/quickref.page +134 -125
- data/doc/syntax.page +304 -302
- data/lib/kramdown/converter/base.rb +14 -0
- data/lib/kramdown/converter/html.rb +64 -2
- data/lib/kramdown/converter/latex.rb +14 -7
- data/lib/kramdown/document.rb +7 -3
- data/lib/kramdown/options.rb +13 -1
- data/lib/kramdown/parser/kramdown.rb +70 -17
- data/lib/kramdown/parser/kramdown/abbreviation.rb +65 -0
- data/lib/kramdown/parser/kramdown/attribute_list.rb +2 -1
- data/lib/kramdown/parser/kramdown/blank_line.rb +1 -1
- data/lib/kramdown/parser/kramdown/blockquote.rb +1 -1
- data/lib/kramdown/parser/kramdown/codeblock.rb +2 -2
- data/lib/kramdown/parser/kramdown/eob.rb +1 -1
- data/lib/kramdown/parser/kramdown/extension.rb +86 -6
- data/lib/kramdown/parser/kramdown/header.rb +2 -17
- data/lib/kramdown/parser/kramdown/horizontal_rule.rb +1 -1
- data/lib/kramdown/parser/kramdown/list.rb +8 -2
- data/lib/kramdown/parser/kramdown/math.rb +1 -1
- data/lib/kramdown/parser/kramdown/paragraph.rb +1 -1
- data/lib/kramdown/parser/kramdown/smart_quotes.rb +2 -2
- data/lib/kramdown/parser/kramdown/table.rb +1 -1
- data/lib/kramdown/version.rb +1 -1
- data/man/man1/kramdown.1 +77 -63
- data/test/testcases/block/04_header/with_auto_id_prefix.html +3 -0
- data/test/testcases/block/04_header/with_auto_id_prefix.options +2 -0
- data/test/testcases/block/04_header/with_auto_id_prefix.text +3 -0
- data/test/testcases/block/08_list/item_ial.html +9 -0
- data/test/testcases/block/08_list/item_ial.text +5 -0
- data/test/testcases/block/11_ial/auto_id_and_ial.html +1 -1
- data/test/testcases/block/11_ial/auto_id_and_ial.text +1 -1
- data/test/testcases/block/11_ial/simple.html +5 -0
- data/test/testcases/block/11_ial/simple.text +7 -0
- data/test/testcases/block/12_extension/comment.text +5 -5
- data/test/testcases/block/12_extension/ignored.html +0 -2
- data/test/testcases/block/12_extension/ignored.text +3 -6
- data/test/testcases/block/12_extension/nomarkdown.text +4 -4
- data/test/testcases/block/12_extension/options.html +1 -1
- data/test/testcases/block/12_extension/options.text +5 -6
- data/test/testcases/block/12_extension/options2.text +1 -1
- data/test/testcases/block/12_extension/options3.text +1 -1
- data/test/testcases/span/abbreviations/abbrev.html +8 -0
- data/test/testcases/span/abbreviations/abbrev.text +15 -0
- data/test/testcases/span/abbreviations/abbrev_defs.html +2 -0
- data/test/testcases/span/abbreviations/abbrev_defs.text +5 -0
- data/test/testcases/span/extension/comment.html +6 -0
- data/test/testcases/span/extension/comment.text +6 -0
- data/test/testcases/span/extension/ignored.html +1 -0
- data/test/testcases/span/extension/ignored.text +1 -0
- data/test/testcases/span/extension/nomarkdown.html +1 -0
- data/test/testcases/span/extension/nomarkdown.text +1 -0
- data/test/testcases/span/extension/options.html +1 -0
- data/test/testcases/span/extension/options.text +1 -0
- data/test/testcases/span/ial/simple.html +2 -1
- data/test/testcases/span/ial/simple.text +1 -0
- data/test/testcases/span/text_substitutions/typography.html +3 -0
- data/test/testcases/span/text_substitutions/typography.text +3 -0
- metadata +275 -263
data/bin/kramdown
CHANGED
@@ -36,10 +36,6 @@ OptionParser.new do |opts|
|
|
36
36
|
|
37
37
|
opts.on("-i", "--input ARG", "Specify the input format: kramdown (default)") {|v| options[:input] = v}
|
38
38
|
opts.on("-o", "--ouput ARG", "Specify the output format: html (default) or latex") {|v| format = v}
|
39
|
-
opts.on("-f", "--format ARG", "DEPRACATED: Specify the output format: html (default) or latex") do |v|
|
40
|
-
warn("DEPRECATED: This option will be removed in the next release, use --output instead")
|
41
|
-
format = v
|
42
|
-
end
|
43
39
|
|
44
40
|
opts.on("-v", "--version", "Show the version of kramdown") do
|
45
41
|
puts Kramdown::VERSION
|
data/doc/index.page
CHANGED
@@ -88,7 +88,7 @@ It is probably the fastest pure-Ruby Markdown converter available (February 2010
|
|
88
88
|
faster than [Maruku] and about 10x faster than [BlueFeather].
|
89
89
|
|
90
90
|
<p class="a-center">
|
91
|
-
The latest version of kramdown is <b>0.
|
91
|
+
The latest version of kramdown is <b>0.7.0</b> and it was released on <b>2010-05-07</b>.
|
92
92
|
</p>
|
93
93
|
|
94
94
|
[PHP Markdown Extra]: http://michelf.com/projects/php-markdown/extra/
|
data/doc/links.markdown
ADDED
data/doc/news.page
CHANGED
@@ -13,8 +13,9 @@ sort_info: 30
|
|
13
13
|
--- name:newsdata pipeline:erb
|
14
14
|
<%
|
15
15
|
context.content_node.tree.node_access[:alcn].select do |na,no|
|
16
|
-
|
16
|
+
na =~ /\/news\/.+/ && no.is_file?
|
17
17
|
end.collect {|na,no| no}.sort.reverse.each do |node|
|
18
|
+
context.options['contentprocessor.kramdown.options'] = {:auto_id_prefix => node.lcn.tr('.', '-')}
|
18
19
|
%>
|
19
20
|
|
20
21
|
<div class='news-item'>
|
data/doc/quickref.page
CHANGED
@@ -33,40 +33,40 @@ Live browser view of example code
|
|
33
33
|
|
34
34
|
## Paragraphs
|
35
35
|
|
36
|
-
{
|
36
|
+
{kdlink: {oid: paragraphs, part: "paragraphs"}}
|
37
37
|
|
38
38
|
Paragraphs are separated by one or more blank lines:
|
39
39
|
|
40
|
-
{::
|
40
|
+
{kdexample::}
|
41
41
|
The first paragraph.
|
42
42
|
|
43
43
|
Another paragraph
|
44
|
-
{
|
44
|
+
{kdexample}
|
45
45
|
|
46
46
|
Explicit line breaks in a paragraph can be made by using two spaces or two backslashes at the end of a line:
|
47
47
|
|
48
|
-
{::
|
48
|
+
{kdexample::}
|
49
49
|
This is a paragraph
|
50
50
|
which contains a hard line break.
|
51
|
-
{
|
51
|
+
{kdexample}
|
52
52
|
|
53
53
|
|
54
54
|
## Headers
|
55
55
|
|
56
|
-
{
|
56
|
+
{kdlink: {oid: headers, part: "headers"}}
|
57
57
|
|
58
58
|
kramdown supports Setext style headers and atx style headers. A header must always be preceded by a
|
59
59
|
blank line except at the beginning of the document:
|
60
60
|
|
61
|
-
{::
|
61
|
+
{kdexample::}
|
62
62
|
First level header
|
63
63
|
==================
|
64
64
|
|
65
65
|
Second level header
|
66
66
|
-------------------
|
67
|
-
{
|
67
|
+
{kdexample}
|
68
68
|
|
69
|
-
{::
|
69
|
+
{kdexample::}
|
70
70
|
# H1 header
|
71
71
|
|
72
72
|
## H2 header
|
@@ -78,70 +78,68 @@ Second level header
|
|
78
78
|
##### H5 header
|
79
79
|
|
80
80
|
###### H6 header
|
81
|
-
{
|
81
|
+
{kdexample}
|
82
82
|
|
83
83
|
If you set the option `auto_ids` to `false` (for example, by using the `options` extension, see
|
84
|
-
[
|
84
|
+
[Extensions](#extensions)), then the automatic header ID generation is turned off:
|
85
85
|
|
86
|
-
{::
|
87
|
-
|
88
|
-
|
89
|
-
{::options:: auto_ids="false"}
|
86
|
+
{kdexample::}
|
87
|
+
{:options auto_ids="false" /}
|
90
88
|
|
91
89
|
# A header without an ID
|
92
|
-
{
|
90
|
+
{kdexample}
|
93
91
|
|
94
92
|
|
95
93
|
## Blockquotes
|
96
94
|
|
97
|
-
{
|
95
|
+
{kdlink: {oid: blockquotes, part: "blockquotes"}}
|
98
96
|
|
99
97
|
A blockquote is started using the `>` marker followed by an optional space; all following lines that
|
100
98
|
are also started with the blockquote marker belong to the blockquote. You can use any block level
|
101
99
|
elements inside a blockquote:
|
102
100
|
|
103
|
-
{::
|
101
|
+
{kdexample::}
|
104
102
|
> A sample blockquote.
|
105
103
|
> >Nested blockquotes are
|
106
104
|
> >also possible.
|
107
105
|
>
|
108
106
|
> ## Headers work too
|
109
107
|
> This is the outer quote again.
|
110
|
-
{
|
108
|
+
{kdexample}
|
111
109
|
|
112
110
|
|
113
111
|
## Code Blocks
|
114
112
|
|
115
|
-
{
|
113
|
+
{kdlink: {oid: code-blocks, part: "code blocks"}}
|
116
114
|
|
117
115
|
kramdown supports two different code block styles. One uses lines indented with either four spaces
|
118
116
|
or one tab whereas the other uses lines with tilde characters as delimiters -- therefore the content
|
119
117
|
does not need to be indented:
|
120
118
|
|
121
|
-
{::
|
119
|
+
{kdexample::}
|
122
120
|
This is a sample code block.
|
123
121
|
|
124
122
|
Continued here.
|
125
|
-
{
|
123
|
+
{kdexample}
|
126
124
|
|
127
|
-
{::
|
125
|
+
{kdexample::}
|
128
126
|
~~~~~~
|
129
127
|
This is also a code block.
|
130
128
|
~~~
|
131
129
|
Ending lines must have at least as
|
132
130
|
many tildes as the starting line.
|
133
131
|
~~~~~~~~~~~~
|
134
|
-
{
|
132
|
+
{kdexample}
|
135
133
|
|
136
134
|
|
137
135
|
## Horizontal Rules
|
138
136
|
|
139
|
-
{
|
137
|
+
{kdlink: {oid: horizontal-rules, part: "horizontal rules"}}
|
140
138
|
|
141
139
|
It is easy to insert a horizontal rule in kramdown: just use three or more asterisks, dashes or
|
142
140
|
underscores, optionally separated by spaces or tabs, on an otherwise blank line:
|
143
141
|
|
144
|
-
{::
|
142
|
+
{kdexample::}
|
145
143
|
* * *
|
146
144
|
|
147
145
|
\---
|
@@ -149,28 +147,28 @@ underscores, optionally separated by spaces or tabs, on an otherwise blank line:
|
|
149
147
|
_ _ _ _
|
150
148
|
|
151
149
|
---------------
|
152
|
-
{
|
150
|
+
{kdexample}
|
153
151
|
|
154
152
|
|
155
153
|
## Lists
|
156
154
|
|
157
|
-
{
|
155
|
+
{kdlink: {oid: lists, part: "lists"}}
|
158
156
|
|
159
157
|
kramdown supports ordered and unordered lists. Ordered lists are started by using a number followed
|
160
158
|
by a period, a space and then the list item text. The content of a list item consists of block level
|
161
159
|
elements. All lines which have the same indent as the text of the line with the list marker belong
|
162
160
|
to the list item:
|
163
161
|
|
164
|
-
{::
|
162
|
+
{kdexample::}
|
165
163
|
1. This is a list item
|
166
164
|
2. And another item
|
167
165
|
2. And the third one
|
168
166
|
with additional. text
|
169
|
-
{
|
167
|
+
{kdexample}
|
170
168
|
|
171
169
|
As the content consists of block level elements you can do things like the following:
|
172
170
|
|
173
|
-
{::
|
171
|
+
{kdexample::}
|
174
172
|
1. This is a list item
|
175
173
|
|
176
174
|
> with a blockquote
|
@@ -178,47 +176,47 @@ As the content consists of block level elements you can do things like the follo
|
|
178
176
|
# And a header
|
179
177
|
|
180
178
|
2. Followed by another item
|
181
|
-
{
|
179
|
+
{kdexample}
|
182
180
|
|
183
181
|
Nested lists are also easy to create:
|
184
182
|
|
185
|
-
{::
|
183
|
+
{kdexample::}
|
186
184
|
1. Item one
|
187
185
|
1. sub item one
|
188
186
|
2. sub item two
|
189
187
|
3. sub item three
|
190
188
|
2. Item two
|
191
|
-
{
|
189
|
+
{kdexample}
|
192
190
|
|
193
191
|
Lists can occur directly after other block level elements, however, there has to be at least one
|
194
192
|
blank line if you want to follow a paragraph with a list:
|
195
193
|
|
196
|
-
{::
|
194
|
+
{kdexample::}
|
197
195
|
This is a paragraph.
|
198
196
|
1. This is NOT a list.
|
199
197
|
|
200
198
|
1. This is a list!
|
201
|
-
{
|
199
|
+
{kdexample}
|
202
200
|
|
203
201
|
Unordered lists are started by using an asterisk, a dash or a plus sign (they can be mixed) and a
|
204
202
|
space. Apart from that unordered lists follow the same rules as ordered lists:
|
205
203
|
|
206
|
-
{::
|
204
|
+
{kdexample::}
|
207
205
|
* Item one
|
208
206
|
+ Item two
|
209
207
|
- Item three
|
210
|
-
{
|
208
|
+
{kdexample}
|
211
209
|
|
212
210
|
## Definition Lists
|
213
211
|
|
214
|
-
{
|
212
|
+
{kdlink: {oid: definition-lists, part: "definition lists"}}
|
215
213
|
|
216
214
|
A definition list works similar to a normal list and is used to associate definitions with terms.
|
217
215
|
Definition lists are started when a normal paragraph is followed by a line starting with a colon and
|
218
216
|
then the definition text. One term can have many definitions and multiple terms can have the same
|
219
217
|
definition. Each line of the preceding paragraph is assumed to contain one term, for example:
|
220
218
|
|
221
|
-
{::
|
219
|
+
{kdexample::}
|
222
220
|
term
|
223
221
|
: definition
|
224
222
|
: another definition
|
@@ -226,35 +224,35 @@ term
|
|
226
224
|
another term
|
227
225
|
and another term
|
228
226
|
: and a definition for the term
|
229
|
-
{
|
227
|
+
{kdexample}
|
230
228
|
|
231
229
|
If you insert a blank line before a definition (note: there must only be one blank line between the
|
232
230
|
terms and the first definition), the definition will be wrapped in a paragraph:
|
233
231
|
|
234
|
-
{::
|
232
|
+
{kdexample::}
|
235
233
|
term
|
236
234
|
|
237
235
|
: definition
|
238
236
|
: definition
|
239
|
-
{
|
237
|
+
{kdexample}
|
240
238
|
|
241
239
|
Each term can be styled using span level elements and each definition is parsed as block level
|
242
240
|
elements, i.e. you can use any block level in a definition. Just use the same indent for the lines
|
243
241
|
following the definition line:
|
244
242
|
|
245
|
-
{::
|
243
|
+
{kdexample::}
|
246
244
|
This *is* a term
|
247
245
|
|
248
246
|
: This will be a para
|
249
247
|
> a blockquote
|
250
248
|
|
251
249
|
# A header
|
252
|
-
{
|
250
|
+
{kdexample}
|
253
251
|
|
254
252
|
|
255
253
|
## Tables
|
256
254
|
|
257
|
-
{
|
255
|
+
{kdlink: {oid: tables, part: "tables"}}
|
258
256
|
|
259
257
|
kramdown supports a syntax for creating simple tables. A line starting with a pipe character (`|`)
|
260
258
|
starts a table row. However, if the pipe characters is immediately followed by a dash (`-`), a
|
@@ -263,12 +261,12 @@ separator line is created. Separator lines are used to split the table header fr
|
|
263
261
|
pipe character is followed by an equal sign (`=`), the tables rows below it are part of the table
|
264
262
|
footer.
|
265
263
|
|
266
|
-
{::
|
264
|
+
{kdexample::}
|
267
265
|
| A simple | table |
|
268
266
|
| with multiple | lines|
|
269
|
-
{
|
267
|
+
{kdexample}
|
270
268
|
|
271
|
-
{::
|
269
|
+
{kdexample::}
|
272
270
|
| Header1 | Header2 | Header3 |
|
273
271
|
|:--------|:-------:|--------:|
|
274
272
|
| cell1 | cell2 | cell3 |
|
@@ -279,12 +277,12 @@ footer.
|
|
279
277
|
|=====
|
280
278
|
| Foot1 | Foot2 | Foot3
|
281
279
|
{: rules="groups"}
|
282
|
-
{
|
280
|
+
{kdexample}
|
283
281
|
|
284
282
|
|
285
283
|
## HTML elements
|
286
284
|
|
287
|
-
{
|
285
|
+
{kdlink: {oid: html-blocks, part: "HTML blocks"}}
|
288
286
|
|
289
287
|
kramdown allows you to use block level HTML tags (`div`, `p`, `pre`, ...) to markup whole blocks of
|
290
288
|
text -- just start a line with a block level HTML tag. kramdown syntax is normally not processed
|
@@ -292,48 +290,48 @@ inside an HTML tag but this can be changed with the `parse_block_html` option. I
|
|
292
290
|
set to `true`, then the content of a block level HTML tag is parsed by kramdown either as block
|
293
291
|
level or span level text, depending on the tag:
|
294
292
|
|
295
|
-
{::
|
293
|
+
{kdexample::}
|
296
294
|
<div style="float: right">
|
297
295
|
Something that stays right and is not wrapped in a para.
|
298
296
|
</div>
|
299
|
-
{
|
297
|
+
{options: parse_block_html="true"}
|
300
298
|
<div>
|
301
299
|
This is wrapped in a para.
|
302
300
|
</div>
|
303
301
|
<p>
|
304
302
|
This can contain only *span* level elements.
|
305
303
|
</p>
|
306
|
-
{
|
304
|
+
{kdexample}
|
307
305
|
|
308
306
|
|
309
307
|
## Block Attributes
|
310
308
|
|
311
|
-
{
|
312
|
-
{
|
309
|
+
{kdlink: {oid: block-inline-attribute-lists, part: "block IALs"}}
|
310
|
+
{kdlink: {oid: attribute-list-definitions, part: "ALDs"}}
|
313
311
|
|
314
312
|
You can assign any attribute to a block level element. Just directly follow the block with a *block
|
315
313
|
inline attribute list* (or short: block IAL). A block IAL consists of a left curly brace, followed
|
316
314
|
by a colon, the attribute definitions and a right curly brace. Here is a simple example which sets the
|
317
315
|
`title` attribute of a block quote:
|
318
316
|
|
319
|
-
{::
|
317
|
+
{kdexample::}
|
320
318
|
> A nice blockquote
|
321
319
|
{: title="Blockquote title"}
|
322
|
-
{
|
320
|
+
{kdexample}
|
323
321
|
|
324
322
|
As one often wants to set one or more CSS classes on an element, there is an easy shortcut:
|
325
323
|
|
326
|
-
{::
|
324
|
+
{kdexample::}
|
327
325
|
> A nice blockquote
|
328
326
|
{: .class1 .class2}
|
329
|
-
{
|
327
|
+
{kdexample}
|
330
328
|
|
331
329
|
A shortcut for setting the ID is also provided. Just prefix the ID with a hash symbol:
|
332
330
|
|
333
|
-
{::
|
331
|
+
{kdexample::}
|
334
332
|
> A nice blockquote
|
335
333
|
{: #with-an-id}
|
336
|
-
{
|
334
|
+
{kdexample}
|
337
335
|
|
338
336
|
Sometimes one wants to use the same attributes for many elements. kramdown allows you to define the
|
339
337
|
attributes in one place with an *attribute list definition* (or short: ALD) and just reference this
|
@@ -341,61 +339,57 @@ definition in a block IAL. An ALD has the same structure as a block IAL but the
|
|
341
339
|
replace with a colon, the reference name and another colon. By just using the reference name as-is
|
342
340
|
in a block IAL, one can include the attributes of the referenced ALD:
|
343
341
|
|
344
|
-
{::
|
342
|
+
{kdexample::}
|
345
343
|
{:refdef: .c1 #id .c2 title="title"}
|
346
344
|
paragraph
|
347
345
|
{: refdef}
|
348
|
-
{
|
346
|
+
{kdexample}
|
349
347
|
|
350
348
|
The order in a block IAL or ALD is important because later defined attributes overwrite (with the
|
351
349
|
exception of the shortcut for CSS classes) prior defined attributes:
|
352
350
|
|
353
|
-
{::
|
351
|
+
{kdexample::}
|
354
352
|
{:refdef: .c1 #id .c2 title="title"}
|
355
353
|
paragraph
|
356
354
|
{: refdef .c3 title="t" #para}
|
357
|
-
{
|
355
|
+
{kdexample}
|
358
356
|
|
359
357
|
|
360
|
-
##
|
358
|
+
## Extensions
|
361
359
|
|
362
|
-
{
|
360
|
+
{kdlink: {oid: extensions, part: "extensions"}}
|
363
361
|
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
362
|
+
kramdown provides some less used functionality through a common syntax. This will allow the easy
|
363
|
+
addition of other extensions if need arises. Currently, there are extensions for ignoring text (i.e.
|
364
|
+
treating text as comment), for inserting arbitrary text as-is into the output and for setting
|
365
|
+
kramdown options.
|
368
366
|
|
369
367
|
Here is an example that shows how to insert comments into text:
|
370
368
|
|
371
|
-
{::
|
369
|
+
{kdexample::}
|
372
370
|
This is a paragraph
|
373
|
-
{
|
371
|
+
{:comment}
|
374
372
|
This is a comment which is
|
375
373
|
completely ignored.
|
376
|
-
{
|
374
|
+
{:/comment}
|
377
375
|
... paragraph continues here.
|
378
376
|
|
379
|
-
|
380
|
-
|
381
|
-
{
|
382
|
-
{::kdexample:}
|
377
|
+
Extensions can also be used
|
378
|
+
inline {:nomarkdown}**see**{:/}!
|
379
|
+
{kdexample}
|
383
380
|
|
384
|
-
As one can see from the above example, the syntax for
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
381
|
+
As one can see from the above example, the syntax for extensions is nearly identical to that of
|
382
|
+
ALDs. However, there is no trailing colon after the extension name and the extension end tag needs a
|
383
|
+
slash between the colon and the extension name. One can also use the short form of the end tag, i.e.
|
384
|
+
`{:/}`. Attribute definitions can be specified on the start tag by separating them with a space from
|
385
|
+
the extension name. Also, if the extension does not have a body, there needs to be a slash right
|
386
|
+
before the closing brace:
|
389
387
|
|
390
|
-
{::
|
391
|
-
|
392
|
-
{::options:: auto_ids="false"}
|
388
|
+
{kdexample::}
|
389
|
+
{:options auto_ids="false" /}
|
393
390
|
|
394
391
|
# Header without id
|
395
|
-
{
|
396
|
-
|
397
|
-
# Header with id
|
398
|
-
{::kdexample:}
|
392
|
+
{kdexample}
|
399
393
|
|
400
394
|
|
401
395
|
|
@@ -404,115 +398,115 @@ used, then the extension does not have a body, for example:
|
|
404
398
|
|
405
399
|
## Emphasis
|
406
400
|
|
407
|
-
{
|
401
|
+
{kdlink: {oid: emphasis, part: "emphasis"}}
|
408
402
|
|
409
403
|
Emphasis can be added to text by surrounding the text with either asterisks or underscores:
|
410
404
|
|
411
|
-
{::
|
405
|
+
{kdexample::}
|
412
406
|
This is *emphasized*,
|
413
407
|
_this_ too!
|
414
|
-
{
|
408
|
+
{kdexample}
|
415
409
|
|
416
410
|
Strong emphasis can be done by doubling the delimiters:
|
417
411
|
|
418
|
-
{::
|
412
|
+
{kdexample::}
|
419
413
|
This is **strong**,
|
420
414
|
__this__ too!
|
421
|
-
{
|
415
|
+
{kdexample}
|
422
416
|
|
423
417
|
The form with the asterisks can also be used to markup parts of words:
|
424
418
|
|
425
|
-
{::
|
419
|
+
{kdexample::}
|
426
420
|
This w**ork**s as expected!
|
427
|
-
{
|
421
|
+
{kdexample}
|
428
422
|
|
429
423
|
|
430
424
|
## Links and Images
|
431
425
|
|
432
|
-
{
|
426
|
+
{kdlink: {oid: links-and-images, part: "links and images"}}
|
433
427
|
|
434
428
|
A simple link can be created by surrounding the text with square brackets and the link URL with
|
435
429
|
parentheses:
|
436
430
|
|
437
|
-
{::
|
431
|
+
{kdexample::}
|
438
432
|
A [link](http://kramdown.rubyforge.org)
|
439
433
|
to the kramdown homepage.
|
440
|
-
{
|
434
|
+
{kdexample}
|
441
435
|
|
442
436
|
You can also add title information to the link:
|
443
437
|
|
444
|
-
{::
|
438
|
+
{kdexample::}
|
445
439
|
A [link](http://kramdown.rubyforge.org "hp")
|
446
440
|
to the homepage.
|
447
|
-
{
|
441
|
+
{kdexample}
|
448
442
|
|
449
443
|
There is another way to create links which does not interrupt the text flow. The URL and title are
|
450
444
|
defined using a reference name and this reference name is then used in square brackets instead of
|
451
445
|
the link URL:
|
452
446
|
|
453
|
-
{::
|
447
|
+
{kdexample::}
|
454
448
|
A [link][kramdown hp]
|
455
449
|
to the homepage.
|
456
450
|
|
457
451
|
[kramdown hp]: http://kramdown.rubyforge.org "hp"
|
458
|
-
{
|
452
|
+
{kdexample}
|
459
453
|
|
460
454
|
If the link text itself is the reference name, the second set of square brackets can be omitted:
|
461
455
|
|
462
|
-
{::
|
456
|
+
{kdexample::}
|
463
457
|
A link to the [kramdown hp].
|
464
458
|
|
465
459
|
[kramdown hp]: http://kramdown.rubyforge.org "hp"
|
466
|
-
{
|
460
|
+
{kdexample}
|
467
461
|
|
468
462
|
Images can be created in a similar way: just use an exclamation mark before the square brackets. The
|
469
463
|
link text will become the alternative text of the image and the link URL specifies the image source:
|
470
464
|
|
471
|
-
{::
|
465
|
+
{kdexample::}
|
472
466
|
An image: ![gras](img/image.jpg)
|
473
|
-
{
|
467
|
+
{kdexample}
|
474
468
|
|
475
469
|
|
476
470
|
## Inline Code
|
477
471
|
|
478
|
-
{
|
472
|
+
{kdlink: {oid: code-spans, part: "code spans"}}
|
479
473
|
|
480
474
|
Text phrases can be easily marked up as code by surrounding them with backticks:
|
481
475
|
|
482
|
-
{::
|
476
|
+
{kdexample::}
|
483
477
|
Use `Kramdown::Document.new(text).to_html`
|
484
478
|
to convert the `text` in kramdown
|
485
479
|
syntax to HTML.
|
486
|
-
{
|
480
|
+
{kdexample}
|
487
481
|
|
488
482
|
If you want to use literal backticks in your code, just use two or more backticks as delimiters. The
|
489
483
|
space right after the beginning delimiter and the one right before the closing delimiter are ignore:
|
490
484
|
|
491
|
-
{::
|
485
|
+
{kdexample::}
|
492
486
|
Use backticks to markup code,
|
493
487
|
e.g. `` `code` ``.
|
494
|
-
{
|
488
|
+
{kdexample}
|
495
489
|
|
496
490
|
|
497
491
|
## Footnotes
|
498
492
|
|
499
|
-
{
|
493
|
+
{kdlink: {oid: footnotes, part: "footnotes"}}
|
500
494
|
|
501
495
|
Footnotes can easily be used in kramdown. Just set a footnote marker (consists of square brackets
|
502
496
|
with a caret and the footnote name inside) in the text and somewhere else the footnote definition (which
|
503
497
|
basically looks like a reference link definition):
|
504
498
|
|
505
|
-
{::
|
499
|
+
{kdexample::}
|
506
500
|
This is a text with a
|
507
501
|
footnote[^1].
|
508
502
|
|
509
503
|
[^1]: And here is the definition.
|
510
|
-
{
|
504
|
+
{kdexample}
|
511
505
|
|
512
506
|
The footnote definition can contain any block level element, all lines following a footnote
|
513
507
|
definition indented with four spaces or one tab belong to the definition:
|
514
508
|
|
515
|
-
{::
|
509
|
+
{kdexample::}
|
516
510
|
This is a text with a
|
517
511
|
footnote[^2].
|
518
512
|
|
@@ -520,32 +514,47 @@ footnote[^2].
|
|
520
514
|
And here is the definition.
|
521
515
|
|
522
516
|
> With a quote!
|
523
|
-
{
|
517
|
+
{kdexample}
|
524
518
|
|
525
519
|
As can be seen above the footnote name is only used for the anchors and the numbering is done
|
526
520
|
automatically in document order.
|
527
521
|
|
528
522
|
|
523
|
+
## Abbreviations
|
524
|
+
|
525
|
+
{kdlink: {oid: abbreviations, part: "abbreviations"}}
|
526
|
+
|
527
|
+
Abbreviations will work out of the box once you add an abbreviation definition. So you can just
|
528
|
+
write the text and add the definitions later on.
|
529
|
+
|
530
|
+
{kdexample::}
|
531
|
+
This is an HTML
|
532
|
+
example.
|
533
|
+
|
534
|
+
*[HTML]: Hyper Text Markup Language
|
535
|
+
{kdexample}
|
536
|
+
|
537
|
+
|
529
538
|
## HTML Elements
|
530
539
|
|
531
|
-
{
|
540
|
+
{kdlink: {oid: html-spans, part: "HTML spans"}}
|
532
541
|
|
533
542
|
HTML is not only supported on the block level but also on the span level:
|
534
543
|
|
535
|
-
{::
|
544
|
+
{kdexample::}
|
536
545
|
This is <span style="color: red">written in
|
537
546
|
red</span>.
|
538
|
-
{
|
547
|
+
{kdexample}
|
539
548
|
|
540
549
|
|
541
550
|
## Inline Attributes
|
542
551
|
|
543
|
-
{
|
552
|
+
{kdlink: {oid: span-inline-attribute-lists, part: "span IALs"}}
|
544
553
|
|
545
554
|
As with a block level element you can assign any attribute to a span level elements using a *span
|
546
555
|
inline attribute list* (or short: span IAL). A span IAL has the same syntax as a block IAL and must
|
547
556
|
immediately follow the span level element:
|
548
557
|
|
549
|
-
{::
|
558
|
+
{kdexample::}
|
550
559
|
This is *red*{: style="color: red"}.
|
551
|
-
{
|
560
|
+
{kdexample}
|