kramdown 0.3.0 → 0.4.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.

Files changed (48) hide show
  1. data/ChangeLog +243 -0
  2. data/Rakefile +0 -17
  3. data/VERSION +1 -1
  4. data/benchmark/historic-jruby-1.4.0.dat +7 -7
  5. data/benchmark/historic-ruby-1.8.6.dat +7 -7
  6. data/benchmark/historic-ruby-1.8.7.dat +7 -7
  7. data/benchmark/historic-ruby-1.9.1p243.dat +7 -7
  8. data/benchmark/historic-ruby-1.9.2dev.dat +7 -7
  9. data/benchmark/testing.sh +1 -1
  10. data/doc/index.page +4 -3
  11. data/doc/quickref.page +31 -1
  12. data/doc/syntax.page +166 -12
  13. data/lib/kramdown/converter.rb +107 -56
  14. data/lib/kramdown/document.rb +16 -1
  15. data/lib/kramdown/extension.rb +19 -0
  16. data/lib/kramdown/parser/kramdown.rb +2 -1
  17. data/lib/kramdown/parser/kramdown/attribute_list.rb +2 -2
  18. data/lib/kramdown/parser/kramdown/codeblock.rb +5 -9
  19. data/lib/kramdown/parser/kramdown/escaped_chars.rb +1 -1
  20. data/lib/kramdown/parser/kramdown/footnote.rb +2 -1
  21. data/lib/kramdown/parser/kramdown/table.rb +125 -0
  22. data/lib/kramdown/version.rb +1 -1
  23. data/test/testcases/block/06_codeblock/with_blank_line.text +1 -0
  24. data/test/testcases/block/09_html/parse_as_span.html +3 -0
  25. data/test/testcases/block/09_html/parse_as_span.text +2 -0
  26. data/test/testcases/block/11_ial/simple.html +3 -0
  27. data/test/testcases/block/11_ial/simple.text +4 -2
  28. data/test/testcases/block/12_extension/options.html +1 -1
  29. data/test/testcases/block/12_extension/options2.html +1 -1
  30. data/test/testcases/block/12_extension/options3.html +7 -0
  31. data/test/testcases/block/12_extension/options3.text +7 -0
  32. data/test/testcases/block/13_definition_list/no_def_list.html +2 -0
  33. data/test/testcases/block/13_definition_list/no_def_list.text +2 -0
  34. data/test/testcases/block/14_table/errors.html +3 -0
  35. data/test/testcases/block/14_table/errors.text +3 -0
  36. data/test/testcases/block/14_table/footer.html +65 -0
  37. data/test/testcases/block/14_table/footer.text +25 -0
  38. data/test/testcases/block/14_table/header.html +103 -0
  39. data/test/testcases/block/14_table/header.text +32 -0
  40. data/test/testcases/block/14_table/no_table.html +3 -0
  41. data/test/testcases/block/14_table/no_table.text +3 -0
  42. data/test/testcases/block/14_table/simple.html +61 -0
  43. data/test/testcases/block/14_table/simple.text +16 -0
  44. data/test/testcases/span/04_footnote/footnote_nr.html +1 -1
  45. data/test/testcases/span/04_footnote/markers.html +1 -1
  46. data/test/testcases/span/escaped_chars/normal.html +4 -0
  47. data/test/testcases/span/escaped_chars/normal.text +4 -0
  48. metadata +17 -2
data/ChangeLog CHANGED
@@ -1,3 +1,246 @@
1
+ commit fa3d9d59c3e912a011a26f10a74ee0858cafe4dd
2
+ Author: Thomas Leitner <t_leitner@gmx.at>
3
+ Date: Fri Jan 22 17:41:32 2010 +0100
4
+
5
+ Small fix for testing script
6
+
7
+ benchmark/testing.sh
8
+
9
+ commit 8c765d5783b460a46fdd8b547eeca91e7f48f0da
10
+ Author: Thomas Leitner <t_leitner@gmx.at>
11
+ Date: Fri Jan 22 17:38:10 2010 +0100
12
+
13
+ Updated release file and homepage
14
+
15
+ doc/index.page
16
+ doc/news/release_0_4_0.page
17
+
18
+ commit c6f7bcea913b19cc8c255f9a0358188db54cead4
19
+ Author: Thomas Leitner <t_leitner@gmx.at>
20
+ Date: Fri Jan 22 17:37:53 2010 +0100
21
+
22
+ Updated benchmark data
23
+
24
+ benchmark/historic-jruby-1.4.0.dat
25
+ benchmark/historic-ruby-1.8.6.dat
26
+ benchmark/historic-ruby-1.8.7.dat
27
+ benchmark/historic-ruby-1.9.1p243.dat
28
+ benchmark/historic-ruby-1.9.2dev.dat
29
+ doc/img/graph-jruby-1.4.0.png
30
+ doc/img/graph-ruby-1.8.6.png
31
+ doc/img/graph-ruby-1.8.7.png
32
+ doc/img/graph-ruby-1.9.1p243.png
33
+ doc/img/graph-ruby-1.9.2dev.png
34
+
35
+ commit 2d531e0984e9db1656e1d7dbde0dbc3c96383d05
36
+ Author: Thomas Leitner <t_leitner@gmx.at>
37
+ Date: Fri Jan 22 16:55:48 2010 +0100
38
+
39
+ Small fix for syntax highlighting test
40
+
41
+ test/testcases/block/12_extension/options3.html
42
+
43
+ commit e3f053d87d85ba0c36befe489fe777b954f04079
44
+ Author: Thomas Leitner <t_leitner@gmx.at>
45
+ Date: Wed Jan 20 18:39:25 2010 +0100
46
+
47
+ Implemented syntax highlighting of codeblocks via CodeRay library
48
+
49
+ doc/index.page
50
+ doc/news/release_0_4_0.page
51
+ doc/syntax.page
52
+ lib/kramdown/converter.rb
53
+ lib/kramdown/document.rb
54
+ lib/kramdown/extension.rb
55
+ lib/kramdown/parser/kramdown/attribute_list.rb
56
+ test/testcases/block/12_extension/options3.html
57
+ test/testcases/block/12_extension/options3.text
58
+
59
+ commit 9753aa172982fe6b9766b032017a747d00b1a1b3
60
+ Author: Thomas Leitner <t_leitner@gmx.at>
61
+ Date: Wed Jan 20 18:37:09 2010 +0100
62
+
63
+ Various small fixes
64
+
65
+ Rakefile
66
+ doc/news/release_0_1_0.page
67
+ doc/quickref.page
68
+ doc/syntax.page
69
+
70
+ commit 5c6215f4b8bf26801f6f4af81591ce5714e4abfc
71
+ Author: Thomas Leitner <t_leitner@gmx.at>
72
+ Date: Wed Jan 20 17:51:21 2010 +0100
73
+
74
+ Updated codeblock parser implementation
75
+
76
+ Codeblock lines separated by blank lines are not parsed separately anymore
77
+
78
+ lib/kramdown/parser/kramdown/codeblock.rb
79
+ lib/kramdown/parser/kramdown/footnote.rb
80
+ test/testcases/block/06_codeblock/with_blank_line.text
81
+ test/testcases/block/11_ial/simple.html
82
+ test/testcases/block/11_ial/simple.text
83
+
84
+ commit b9de73dd48590e47a5753f272478f88378ada709
85
+ Author: Thomas Leitner <t_leitner@gmx.at>
86
+ Date: Wed Jan 20 15:46:43 2010 +0100
87
+
88
+ Clarified how options set through the options extension are used
89
+
90
+ doc/syntax.page
91
+
92
+ commit e371bd8ecbbfe1df200240ccd13562dcb8927940
93
+ Author: Thomas Leitner <t_leitner@gmx.at>
94
+ Date: Tue Jan 19 14:58:32 2010 +0100
95
+
96
+ Fixed problem with too many alignment definitions on header sep line
97
+
98
+ lib/kramdown/parser/kramdown/table.rb
99
+ test/testcases/block/14_table/header.html
100
+ test/testcases/block/14_table/header.text
101
+
102
+ commit 8360bed28e436ee621848f60b7db7c2f29ffb573
103
+ Author: Thomas Leitner <t_leitner@gmx.at>
104
+ Date: Tue Jan 19 14:49:19 2010 +0100
105
+
106
+ Updated table spec and implementation sothat header sep lines are a subset of sep lines
107
+
108
+ doc/syntax.page
109
+ lib/kramdown/parser/kramdown/table.rb
110
+ test/testcases/block/14_table/header.html
111
+ test/testcases/block/14_table/header.text
112
+
113
+ commit 59cf34d9a9efd70a69b324097148199bf70b8189
114
+ Author: Thomas Leitner <t_leitner@gmx.at>
115
+ Date: Sat Jan 16 08:13:18 2010 +0100
116
+
117
+ Small fix in table separator line regexps
118
+
119
+ lib/kramdown/parser/kramdown/table.rb
120
+
121
+ commit 6e77f79a5bc37e94267da8b4a42be6da036e6f81
122
+ Author: Thomas Leitner <t_leitner@gmx.at>
123
+ Date: Fri Jan 15 12:14:42 2010 +0100
124
+
125
+ Fixed problem with escaped characters
126
+
127
+ * Added colon to the list of escaped characters in the syntax document
128
+ * Added test cases for escaped colons and pipes
129
+ * Fixed bug in regexp for escaped characters
130
+
131
+ doc/news/release_0_4_0.page
132
+ doc/syntax.page
133
+ lib/kramdown/parser/kramdown/escaped_chars.rb
134
+ test/testcases/block/13_definition_list/no_def_list.html
135
+ test/testcases/block/13_definition_list/no_def_list.text
136
+ test/testcases/block/14_table/no_table.html
137
+ test/testcases/block/14_table/no_table.text
138
+ test/testcases/span/escaped_chars/normal.html
139
+ test/testcases/span/escaped_chars/normal.text
140
+
141
+ commit df5ac74abffb0d78ac3ed05c155c36a83e4af273
142
+ Author: Thomas Leitner <t_leitner@gmx.at>
143
+ Date: Thu Jan 14 12:09:55 2010 +0100
144
+
145
+ Two small doc fixes
146
+
147
+ doc/syntax.page
148
+
149
+ commit a1f6c3c755c1b18502403c1ac6236a5dbcd47dd8
150
+ Author: Thomas Leitner <t_leitner@gmx.at>
151
+ Date: Thu Jan 14 08:45:04 2010 +0100
152
+
153
+ Fixed test case for table headers
154
+
155
+ test/testcases/block/14_table/header.html
156
+
157
+ commit b79822c8a78729be53a1d9a9db3f783c3b22a0ae
158
+ Author: Thomas Leitner <t_leitner@gmx.at>
159
+ Date: Thu Jan 14 08:44:17 2010 +0100
160
+
161
+ Reimplemented HTML converter to use post- instead of pre-order iteration
162
+
163
+ This is needed to ease the implementation of the td/th conversion.
164
+ It is also a little bit faster than the old version.
165
+
166
+ lib/kramdown/converter.rb
167
+
168
+ commit 17caef2da4cbe065e0509ca59e04daee8baca425
169
+ Author: Thomas Leitner <t_leitner@gmx.at>
170
+ Date: Wed Jan 13 15:36:34 2010 +0100
171
+
172
+ Changed CSS class name kramdown-footnotes to footnotes
173
+
174
+ doc/news/release_0_4_0.page
175
+ lib/kramdown/converter.rb
176
+ test/testcases/block/12_extension/options.html
177
+ test/testcases/block/12_extension/options2.html
178
+ test/testcases/span/04_footnote/footnote_nr.html
179
+ test/testcases/span/04_footnote/markers.html
180
+
181
+ commit d446c6ee421e983bd4cd5a13d3f3341523a3d594
182
+ Author: Thomas Leitner <t_leitner@gmx.at>
183
+ Date: Wed Jan 13 15:25:46 2010 +0100
184
+
185
+ Bumped version number and added release notes file
186
+
187
+ doc/news/release_0_4_0.page
188
+ lib/kramdown/version.rb
189
+
190
+ commit 0473b0c40d6a20749772042b64472c5f6514ec0b
191
+ Author: Thomas Leitner <t_leitner@gmx.at>
192
+ Date: Wed Jan 13 15:10:57 2010 +0100
193
+
194
+ Updated table syntax and implemented it
195
+
196
+ doc/quickref.page
197
+ doc/syntax.page
198
+ lib/kramdown/converter.rb
199
+ lib/kramdown/parser/kramdown.rb
200
+ lib/kramdown/parser/kramdown/table.rb
201
+ test/testcases/block/14_table/errors.html
202
+ test/testcases/block/14_table/errors.text
203
+ test/testcases/block/14_table/footer.html
204
+ test/testcases/block/14_table/footer.text
205
+ test/testcases/block/14_table/header.html
206
+ test/testcases/block/14_table/header.text
207
+ test/testcases/block/14_table/simple.html
208
+ test/testcases/block/14_table/simple.text
209
+
210
+ commit d8d032bcb399593d77a15d8269ada8884ba14fa0
211
+ Author: Thomas Leitner <t_leitner@gmx.at>
212
+ Date: Wed Jan 13 10:04:57 2010 +0100
213
+
214
+ Clarified one point regarding HTML span parsing
215
+
216
+ doc/syntax.page
217
+ test/testcases/block/09_html/parse_as_span.html
218
+ test/testcases/block/09_html/parse_as_span.text
219
+
220
+ commit 423ec50ba84518d1b734c396000492da217f5b99
221
+ Author: Thomas Leitner <t_leitner@gmx.at>
222
+ Date: Mon Jan 4 21:52:15 2010 +0100
223
+
224
+ Third table syntax proposal
225
+
226
+ doc/syntax.page
227
+
228
+ commit 66427040dea52007c24ea4df0dd6484b53b11f30
229
+ Author: Thomas Leitner <t_leitner@gmx.at>
230
+ Date: Thu Dec 31 09:26:17 2009 +0100
231
+
232
+ Second table syntax proposal
233
+
234
+ doc/syntax.page
235
+
236
+ commit 4b2d39389cee746ee384e35bdfa60bf5c7313eb4
237
+ Author: Thomas Leitner <t_leitner@gmx.at>
238
+ Date: Wed Dec 30 08:53:15 2009 +0100
239
+
240
+ First table syntax proposal
241
+
242
+ doc/syntax.page
243
+
1
244
  commit fff933c46a6345aca7ee2333b6c71d9466b0e297
2
245
  Author: Thomas Leitner <t_leitner@gmx.at>
3
246
  Date: Sun Dec 20 16:20:10 2009 +0100
data/Rakefile CHANGED
@@ -59,7 +59,6 @@ if defined? Webgen
59
59
  config['sources'] = [['/', "Webgen::Source::FileSystem", 'doc']]
60
60
  config['output'] = ['Webgen::Output::FileSystem', 'htmldoc']
61
61
  config.default_processing_pipeline('Page' => 'erb,tags,kramdown,blocks,fragments')
62
- config['contentprocessor.map']['kramdown'] = 'Kramdown::KDConverter'
63
62
  end
64
63
  end
65
64
 
@@ -259,22 +258,6 @@ task :clobber => ['dev:clobber']
259
258
 
260
259
  module Kramdown
261
260
 
262
- # Processes content in kramdown format using the +maruku+ library.
263
- class KDConverter
264
-
265
- # Convert the content in +context+ to HTML.
266
- def call(context)
267
- extend Webgen::Loggable
268
- doc = ::Kramdown::Document.new(context.content)
269
- context.content = doc.to_html
270
- doc.warnings.each do |warn|
271
- log(:warn) { "Warning while parsing #{context.ref_node.alcn} with kramdown: #{warn}" }
272
- end
273
- context
274
- end
275
-
276
- end
277
-
278
261
  class Extension
279
262
 
280
263
  def parse_kdexample(parser, opts, body)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.4.0
@@ -1,7 +1,7 @@
1
- # kramdown 0.1.0 || kramdown 0.2.0 || kramdown 2009-03-10 || kramdown 2009-11-05 || kramdown 0.3.0
2
- 1 0.21300 0.31800 0.20500 0.24800 0.16800
3
- 2 0.20700 0.22600 0.27200 0.22900 0.26700
4
- 4 0.22000 0.21700 0.21600 0.19600 0.20400
5
- 8 0.36300 0.44500 0.39300 0.34300 0.30100
6
- 16 0.45400 0.53400 1.01400 0.41100 0.46200
7
- 32 1.02800 0.98100 1.70100 0.84600 0.84600
1
+ # kramdown 0.1.0 || kramdown 0.2.0 || kramdown 2009-03-10 || kramdown 2009-11-05 || kramdown 0.3.0 || kramdown 0.4.0
2
+ 1 0.21300 0.31800 0.20500 0.24800 0.16800 0.30400
3
+ 2 0.20700 0.22600 0.27200 0.22900 0.26700 0.23400
4
+ 4 0.22000 0.21700 0.21600 0.19600 0.20400 0.19300
5
+ 8 0.36300 0.44500 0.39300 0.34300 0.30100 0.29500
6
+ 16 0.45400 0.53400 1.01400 0.41100 0.46200 0.48900
7
+ 32 1.02800 0.98100 1.70100 0.84600 0.84600 0.81900
@@ -1,7 +1,7 @@
1
- # kramdown 0.1.0 || kramdown 0.2.0 || kramdown 2009-03-10 || kramdown 2009-11-05 || kramdown 0.3.0
2
- 1 0.01211 0.01274 0.01406 0.01150 0.01385
3
- 2 0.02449 0.02582 0.02545 0.02329 0.02924
4
- 4 0.08228 0.08475 0.07402 0.07921 0.08600
5
- 8 0.12842 0.13410 0.24217 0.12481 0.14426
6
- 16 0.22743 0.27748 0.84538 0.21843 0.29497
7
- 32 0.45690 0.51838 3.95635 0.51363 0.54252
1
+ # kramdown 0.1.0 || kramdown 0.2.0 || kramdown 2009-03-10 || kramdown 2009-11-05 || kramdown 0.3.0 || kramdown 0.4.0
2
+ 1 0.01211 0.01274 0.01406 0.01150 0.01385 0.01359
3
+ 2 0.02449 0.02582 0.02545 0.02329 0.02924 0.02691
4
+ 4 0.08228 0.08475 0.07402 0.07921 0.08600 0.09013
5
+ 8 0.12842 0.13410 0.24217 0.12481 0.14426 0.13687
6
+ 16 0.22743 0.27748 0.84538 0.21843 0.29497 0.28115
7
+ 32 0.45690 0.51838 3.95635 0.51363 0.54252 0.51869
@@ -1,7 +1,7 @@
1
- # kramdown 0.1.0 || kramdown 0.2.0 || kramdown 2009-03-10 || kramdown 2009-11-05 || kramdown 0.3.0
2
- 1 0.01259 0.01329 0.01446 0.01219 0.01580
3
- 2 0.02472 0.02672 0.02637 0.02406 0.02858
4
- 4 0.09610 0.08355 0.07451 0.07719 0.05439
5
- 8 0.13269 0.13811 0.24393 0.12766 0.10869
6
- 16 0.27243 0.27540 0.93940 0.25091 0.28680
7
- 32 0.52890 0.55667 4.93810 0.50113 0.54547
1
+ # kramdown 0.1.0 || kramdown 0.2.0 || kramdown 2009-03-10 || kramdown 2009-11-05 || kramdown 0.3.0 || kramdown 0.4.0
2
+ 1 0.01259 0.01329 0.01446 0.01219 0.01580 0.01397
3
+ 2 0.02472 0.02672 0.02637 0.02406 0.02858 0.02849
4
+ 4 0.09610 0.08355 0.07451 0.07719 0.05439 0.05232
5
+ 8 0.13269 0.13811 0.24393 0.12766 0.10869 0.10471
6
+ 16 0.27243 0.27540 0.93940 0.25091 0.28680 0.27240
7
+ 32 0.52890 0.55667 4.93810 0.50113 0.54547 0.52283
@@ -1,7 +1,7 @@
1
- # kramdown 0.1.0 || kramdown 0.2.0 || kramdown 2009-03-10 || kramdown 2009-11-05 || kramdown 0.3.0
2
- 1 0.02062 0.02216 0.01349 0.02013 0.02152
3
- 2 0.04097 0.04290 0.03316 0.03738 0.03939
4
- 4 0.07696 0.08015 0.07079 0.07084 0.09122
5
- 8 0.16986 0.16998 0.17800 0.14978 0.16856
6
- 16 0.33684 0.34800 0.60818 0.30365 0.35242
7
- 32 0.68273 0.70498 2.77191 0.61580 0.74138
1
+ # kramdown 0.1.0 || kramdown 0.2.0 || kramdown 2009-03-10 || kramdown 2009-11-05 || kramdown 0.3.0 || kramdown 0.4.0
2
+ 1 0.02062 0.02216 0.01349 0.02013 0.02152 0.02025
3
+ 2 0.04097 0.04290 0.03316 0.03738 0.03939 0.03956
4
+ 4 0.07696 0.08015 0.07079 0.07084 0.09122 0.07573
5
+ 8 0.16986 0.16998 0.17800 0.14978 0.16856 0.16380
6
+ 16 0.33684 0.34800 0.60818 0.30365 0.35242 0.33358
7
+ 32 0.68273 0.70498 2.77191 0.61580 0.74138 0.66569
@@ -1,7 +1,7 @@
1
- # kramdown 0.1.0 || kramdown 0.2.0 || kramdown 2009-03-10 || kramdown 2009-11-05 || kramdown 0.3.0
2
- 1 0.01827 0.02000 0.01064 0.01981 0.01830
3
- 2 0.03951 0.04158 0.03260 0.03712 0.04056
4
- 4 0.08055 0.08419 0.05945 0.07256 0.08363
5
- 8 0.14925 0.15101 0.15053 0.14051 0.15830
6
- 16 0.31483 0.31485 0.46291 0.28562 0.31176
7
- 32 0.62318 0.64162 2.17304 0.56619 0.61918
1
+ # kramdown 0.1.0 || kramdown 0.2.0 || kramdown 2009-03-10 || kramdown 2009-11-05 || kramdown 0.3.0 || kramdown 0.4.0
2
+ 1 0.01827 0.02000 0.01064 0.01981 0.01830 0.02061
3
+ 2 0.03951 0.04158 0.03260 0.03712 0.04056 0.04378
4
+ 4 0.08055 0.08419 0.05945 0.07256 0.08363 0.08286
5
+ 8 0.14925 0.15101 0.15053 0.14051 0.15830 0.14567
6
+ 16 0.31483 0.31485 0.46291 0.28562 0.31176 0.30726
7
+ 32 0.62318 0.64162 2.17304 0.56619 0.61918 0.59270
@@ -5,5 +5,5 @@ source ~/.bashrc
5
5
  for VERSION in 1.8.5 1.8.6 1.8.7 1.9.1 1.9.2 'jruby 1.4.0'; do
6
6
  rvm $VERSION
7
7
  echo $(ruby -v)
8
- rake test
8
+ RUBYOPT=-rubygems rake test
9
9
  done
@@ -27,6 +27,7 @@ The kramdown package provides two ways for using it:
27
27
  require 'kramdown'
28
28
 
29
29
  Kramdown::Document.new(text).to_html
30
+ {: lang='ruby'}
30
31
 
31
32
  The second parameter to the `new` call is an options hash for (de)activating certain features. For
32
33
  more information have a look at the [API documentation]({relocatable: rdoc/index.html}).
@@ -78,11 +79,11 @@ and [mailing lists][ml] available if you have any questions!
78
79
  written in Ruby, supports standard Markdown (with some minor modifications) and various extensions
79
80
  that have been made popular by the [PHP Markdown Extra] package and [Maruku].
80
81
 
81
- It is probably the fastest pure-Ruby Markdown converter available (November 2009), being 5x faster
82
- than [Maruku] and about 10x faster than [BlueFeather].
82
+ It is probably the fastest pure-Ruby Markdown converter available (January 2010), being about 4.5x
83
+ faster than [Maruku] and about 10x faster than [BlueFeather].
83
84
 
84
85
  <div class="a-center">
85
- The latest version of kramdown is <b>0.3.0</b> and it was released on <b>2009-12-20</b>.
86
+ The latest version of kramdown is <b>0.4.0</b> and it was released on <b>2010-01-22</b>.
86
87
  </div>
87
88
 
88
89
  [PHP Markdown Extra]: http://michelf.com/projects/php-markdown/extra/
@@ -10,7 +10,7 @@ the kramdown syntax is a superset of the Markdown syntax, only a small part of t
10
10
  is not available in standard Markdown syntax. Note, that only the most basic syntax information is
11
11
  given. However, a link to the detailed syntax for each element is provided (which also details the
12
12
  differences to the standard Markdown syntax). The quick reference is for version **<%=
13
- Kramdown::VERSION %>** of the syntax documentation.
13
+ ::Kramdown::VERSION %>** of the syntax documentation.
14
14
 
15
15
  kramdown has two main classes of elements: block and span level elements. Block level elements are
16
16
  used to create paragraphs, headers, lists and so on whereas span level elements are used to markup
@@ -252,6 +252,36 @@ This *is* a term
252
252
  {::kdexample:}
253
253
 
254
254
 
255
+ ## Tables
256
+
257
+ {::kdlink:: #tables part="tables"}
258
+
259
+ kramdown supports a syntax for creating simple tables. A line starting with a pipe character (`|`)
260
+ starts a table row. However, if the pipe characters is immediately followed by a dash (`-`), a
261
+ separator line is created. Separator lines are used to split the table header from the table body
262
+ (and optionally align the table columns) and to split the table body into multiple parts. If the
263
+ pipe character is followed by an equal sign (`=`), the tables rows below it are part of the table
264
+ footer.
265
+
266
+ {::kdexample:}
267
+ | A simple | table |
268
+ | with multiple | lines|
269
+ {::kdexample:}
270
+
271
+ {::kdexample:}
272
+ | Header1 | Header2 | Header3 |
273
+ |:--------|:-------:|--------:|
274
+ | cell1 | cell2 | cell3 |
275
+ | cell4 | cell5 | cell6 |
276
+ |----
277
+ | cell1 | cell2 | cell3 |
278
+ | cell4 | cell5 | cell6 |
279
+ |=====
280
+ | Foot1 | Foot2 | Foot3
281
+ {: rules="groups"}
282
+ {::kdexample:}
283
+
284
+
255
285
  ## HTML elements
256
286
 
257
287
  {::kdlink:: #html-blocks part="HTML blocks"}
@@ -3,7 +3,7 @@ title: Syntax
3
3
  in_menu: true
4
4
  sort_info: 10
5
5
  ---
6
- This is version **<%= Kramdown::VERSION %>** of the syntax documentation.
6
+ This is version **<%= ::Kramdown::VERSION %>** of the syntax documentation.
7
7
 
8
8
  Table of Contents:
9
9
 
@@ -78,6 +78,8 @@ Following is a list of all those characters (character sequences) that can be es
78
78
  ! bang
79
79
  << left guillemet
80
80
  >> right guillemet
81
+ : colon
82
+ | pipe
81
83
 
82
84
 
83
85
  ## Typographic Symbols
@@ -403,20 +405,36 @@ code.
403
405
  ### Showing Whitespace in a Code Block
404
406
 
405
407
  If you add the class `show-whitespaces` to a code block (using a [block
406
- IAL](#block_inline_attribute_lists)), all spaces are replaced with `&sdot;` and additionally spaces
408
+ IAL](#block-inline-attribute-lists)), all spaces are replaced with `&sdot;` and additionally spaces
407
409
  and tabs in the code block are marked up using HTML `span` tags and the CSS classes:
408
410
 
409
411
  * `ws-space-l`, `ws-tab-l`: leading spaces/tabs
410
412
  * `ws-space-r`, `ws-tab-r`: trailing spaces/tabs
411
413
  * `ws-space`, `ws-tab`: spaces/tabs in between
412
414
 
413
- Here is an example:
415
+ Here is an example output:
414
416
 
415
417
  leading tab and space
416
418
  trailing tab and space
417
419
  {: .show-whitespaces}
418
420
 
419
421
 
422
+ ### Automatic Syntax Highlighting {#syntax-highlighting}
423
+
424
+ kramdown supports syntax highlighting of code through the [CodeRay](http://coderay.rubychan.de)
425
+ library if it is installed and if the HTML converter is used. Syntax highlighting is activated when
426
+ you add the key `lang` to a code block (using a [block IAL](#block-inline-attribute-lists)), its
427
+ value has to be a language supported by CodeRay.
428
+
429
+ Here is an example output:
430
+
431
+ require 'kramdown'
432
+
433
+ Kramdown::Document.new('* something').to_html
434
+ puts 1 + 1
435
+ {: lang='ruby'}
436
+
437
+
420
438
  ## Horizontal Rules
421
439
 
422
440
  A horizontal rule is created by using three or more asterisks, dashes or underscores (these may not
@@ -676,6 +694,138 @@ The rules about having any block level element as first element in a list item a
676
694
  definition.
677
695
 
678
696
 
697
+ ## Tables
698
+
699
+ > This syntax feature is not part of the original Markdown syntax. The syntax is based on the one
700
+ > from the [PHP Markdown Extra] package.
701
+ {: .markdown-difference}
702
+
703
+ Sometimes one wants to include simple tabular data in a kramdown document for which using a
704
+ full-blown HTML table is just too much. kramdown supports this with a simple syntax for ASCII
705
+ tables.
706
+
707
+ There are three different text line types that can be used in a table:
708
+
709
+ * *Table rows* define the content of a table.
710
+
711
+ A table row is started with a pipe character, optionally indented up to three spaces, and then the
712
+ text of the first table cell. Subsequent table cells consist of a pipe character followed by the
713
+ cell text. One may optionally use a pipe character at the the end of a table row line.
714
+
715
+ Header rows, footer rows and normal rows are all made using these table rows. Table cells can only
716
+ contain a single line of text, no multiline text is supported. The text of a table cell is parsed
717
+ as span level elements. Note that literal pipe characters need to be escaped, even if they occur
718
+ in code spans!
719
+
720
+ Here are some example table rows:
721
+
722
+ | First cell|Second cell|Third cell
723
+ | First | Second | Third |
724
+
725
+ * *Separator lines* are used to split the table body into multiple body parts.
726
+
727
+ A separator line is started with a pipe or plus character, optionally indented up to three spaces,
728
+ followed by an optional space, an optional colon, a dash and then any number and combination of
729
+ pipes, dashes, pluses, colons and spaces. The pipe and plus characters can be used to visually
730
+ separate columns although this is not needed. Multiple separator lines after another are treated
731
+ as one separator line.
732
+
733
+ Here are some example separator lines:
734
+
735
+ |----+----|
736
+ +----|----+
737
+ |---------|
738
+ |-
739
+ | :-----: |
740
+
741
+ * The first separator line after at least one table row is treated specially, namely as *header
742
+ separator line*. It is used to demarcate header rows from normal table rows and/or to set column
743
+ alignments. All table rows above the header separator line are considered to be header rows.
744
+
745
+ The header separator line can be specially formatted to contain column alignment definitions: An
746
+ alignment definition consists of an optional space followed by an optional colon, one or more
747
+ dashes, an optional colon and another optional space. The colons of an alignment definition are
748
+ used to set the alignment of a column: if there are no colons, the column uses the default
749
+ alignment, if there is a colon only before the dashes, the column is left aligned, if there are
750
+ colons before and after the dashes, the column is center aligned and if there is only a colon
751
+ after the dashes, the column is right aligned. Each alignment definition sets the alignment for
752
+ one column, the first alignment definition for the first column, the second alignment definition
753
+ for the second column and so on.
754
+
755
+ Here are some example header separator lines with alignment definitions:
756
+
757
+ |---+---+---|
758
+ + :-: |:------| ---:|
759
+ | :-: :- -: -
760
+
761
+ * A *footer separator line* is used to demarcate footer rows from normal table rows. All table rows
762
+ below the footer separator line are considered to be footer rows.
763
+
764
+ A footer separator line is like a normal separator line except that dashes are replaced by equal
765
+ signs. A footer separator line may only appear once in a table. If multiple footer separator lines
766
+ are used in one table, only the last is treated as footer separator line, all others are treated
767
+ as normal separator lines. Normal separator lines that are used after the footer separator line
768
+ are ignored.
769
+
770
+ Here are some example footer separator lines:
771
+
772
+ |====+====|
773
+ +====|====+
774
+ |=========|
775
+ |=
776
+
777
+ Trailing spaces or tabs are ignored in all cases. To simplify table creation and maintenance,
778
+ header, footer and normal separator lines need not specify the same number of columns as table rows;
779
+ even `|-` and `|=` are a valid separators.
780
+
781
+ Given the above components, a table is specified by
782
+
783
+ * an optional separator line,
784
+ * optionally followed by zero, one or more table rows followed by a header separator line,
785
+ * one or more table rows, optionally interspersed with separator lines,
786
+ * optionally followed by a footer separator line and zero, one or more table rows and
787
+ * an optional trailing separator line.
788
+
789
+ > The table syntax differs from the one used in [PHP Markdown Extra] as follows:
790
+ >
791
+ > * kramdown tables have to begin with a pipe character, this is optional in [PHP Markdown Extra].
792
+ > * kramdown tables do not need to have a table header.
793
+ > * kramdown tables can be structured using separator lines.
794
+ > * kramdown tables can contain a table footer.
795
+ {: .markdown-difference}
796
+
797
+ Here is an example for a kramdown table with a table header row, two table bodies and a table footer
798
+ row:
799
+
800
+ |-----------------+------------+-----------------+----------------|
801
+ | Default aligned |Left aligned| Center aligned | Right aligned |
802
+ |-----------------|:-----------|:---------------:|---------------:|
803
+ | First body part |Second cell | Third cell | fourth cell |
804
+ | Second line |foo | **strong** | baz |
805
+ | Third line |quux | baz | bar |
806
+ |-----------------+------------+-----------------+----------------|
807
+ | Second body | | | |
808
+ | 2 line | | | |
809
+ |=================+============+=================+================|
810
+ | Footer row | | | |
811
+ |-----------------+------------+-----------------+----------------|
812
+
813
+ The above example table is rather time-consuming to create without the help of an ASCII table
814
+ editor. However, the table syntax is flexible and the above table could also be written like this:
815
+
816
+ |---
817
+ | Default aligned | Left aligned | Center aligned | Right aligned
818
+ |-|:-|:-:|-:
819
+ | First body part | Second cell | Third cell | fourth cell
820
+ | Second line |foo | **strong** | baz
821
+ | Third line |quux | baz | bar
822
+ |---
823
+ | Second body
824
+ | 2 line
825
+ |===
826
+ | Footer row
827
+
828
+
679
829
  ## HTML Blocks
680
830
 
681
831
  > The original Markdown syntax specifies that an HTML block must start at the left margin, i.e. no
@@ -716,7 +866,8 @@ content is parsed:
716
866
 
717
867
  * Parse as span level elements: If the HTML/XML tag content should be parsed as text containing span
718
868
  level elements, then all text until the *next* matching end tag or until the end of the document
719
- will be the content of the tag and will later be parsed by the span level parser.
869
+ will be the content of the tag and will later be parsed by the span level parser. This also means
870
+ that if the matching end tag is inside what appears to be a code span, it is still used!
720
871
 
721
872
  If there is text after an end tag, it will be parsed as if it appears on a separate line except when
722
873
  inside a raw HTML block.
@@ -842,8 +993,8 @@ comments is not processed:
842
993
  This is an implementation of [Maruku]'s feature for adding attributes to block and span level
843
994
  elements (the naming is also taken from Maruku). This block level element is used to define
844
995
  attributes which can be referenced later. The [Block Inline Attribute
845
- List](#block_inline_attribute_lists) is used to attach attributes to a block level element and the
846
- [Span Inline Attribute List](#span_inline_attribute_lists) is used to attach attributes to a span
996
+ List](#block-inline-attribute-lists) is used to attach attributes to a block level element and the
997
+ [Span Inline Attribute List](#span-inline-attribute-lists) is used to attach attributes to a span
847
998
  level element.
848
999
 
849
1000
  Following are some examples of attribute list definitions (ALDs) and afterwards comes the syntax
@@ -916,7 +1067,7 @@ ALDs are processed like they are defined in one ALD.
916
1067
  {: .markdown-difference}
917
1068
 
918
1069
  This block level element is used to attach attributes to a block level element. A block inline
919
- attribute list (block IAL) has the same structure as an [ALD](#attribute_list_definitions) except
1070
+ attribute list (block IAL) has the same structure as an [ALD](#attribute-list-definitions) except
920
1071
  that the colon/reference name/colon part is replaced by a colon. A block IAL (or two or more block
921
1072
  IALs) has to be put directly after the block level element to which the attributes should be
922
1073
  attached, otherwise it is ignored. This is, for example, the case when there is a blank line between
@@ -949,14 +1100,14 @@ An extension block has two forms, one with a body and one without a body:
949
1100
 
950
1101
  Without a body
951
1102
 
952
- : The extension block line has the same structure as an [ALD](#attribute_list_definitions) except
1103
+ : The extension block line has the same structure as an [ALD](#attribute-list-definitions) except
953
1104
  that the reference name needs to prefixed and postfixed with `:` and identifies the extension to
954
1105
  be used. Attributes can be defined like it is done for an ALD.
955
1106
 
956
1107
  With a body
957
1108
 
958
1109
  : The starting and ending lines of an extension block with a body have the same structure as an
959
- [ALD](#attribute_list_definitions) except that the reference name needs to prefixed with `:` and
1110
+ [ALD](#attribute-list-definitions) except that the reference name needs to prefixed with `:` and
960
1111
  identifies the extension to be used; attributes can be defined on the starting or ending line.
961
1112
  The text between the starting and ending line is passed to the extension and not parsed by
962
1113
  kramdown. If no ending line is found, the starting line is ignored and the body is parsed
@@ -975,8 +1126,11 @@ the body is ignored. The following extensions are built-in:
975
1126
 
976
1127
  `options`
977
1128
 
978
- : Should be used without a body since the body is ignored. Is used for setting options for the
979
- kramdown processor (for example, to enable automatic header ID generation).
1129
+ : Should be used without a body since the body is ignored. Is used for setting the global options
1130
+ for the kramdown processor (for example, to enable automatic header ID generation). Note that
1131
+ options that are used by the parser are immediately effective whereas all other options are not!
1132
+ This means, for example, that it is not possible to set converter options only for some part of
1133
+ a kramdown document.
980
1134
 
981
1135
  Here are some examples for how extension blocks look like:
982
1136
 
@@ -1282,7 +1436,7 @@ name, all footnote definitions but the last are ignored.
1282
1436
  > the [Maruku] package.
1283
1437
  {: .markdown-difference}
1284
1438
 
1285
- This is a version of the [block inline attribute list](#block_inline_attribute_lists) for span level
1439
+ This is a version of the [block inline attribute list](#block-inline-attribute-lists) for span level
1286
1440
  elements. It has the same structure as the block IAL except that leading and trailing spaces are not
1287
1441
  allowed. A span IAL (or two or more span IALs) has to be put directly after the span level element,
1288
1442
  no additional character is allowed between.