kramdown 1.12.0 → 1.13.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 (55) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTERS +3 -2
  3. data/README.md +3 -3
  4. data/Rakefile +2 -1
  5. data/VERSION +1 -1
  6. data/bin/kramdown +4 -2
  7. data/doc/documentation.template +1 -0
  8. data/doc/index.page +2 -2
  9. data/doc/syntax.page +7 -7
  10. data/lib/kramdown/converter.rb +1 -0
  11. data/lib/kramdown/converter/man.rb +303 -0
  12. data/lib/kramdown/converter/math_engine/mathjax.rb +12 -2
  13. data/lib/kramdown/parser/gfm.rb +23 -6
  14. data/lib/kramdown/parser/kramdown/list.rb +4 -2
  15. data/lib/kramdown/parser/kramdown/smart_quotes.rb +1 -1
  16. data/lib/kramdown/parser/kramdown/table.rb +3 -3
  17. data/lib/kramdown/version.rb +1 -1
  18. data/man/man1/kramdown.1 +332 -472
  19. data/test/test_files.rb +15 -0
  20. data/test/testcases/block/08_list/lazy_and_nested.html +9 -0
  21. data/test/testcases/block/08_list/lazy_and_nested.text +4 -0
  22. data/test/testcases/block/14_table/header.html +21 -0
  23. data/test/testcases/block/14_table/header.text +7 -0
  24. data/test/testcases/block/15_math/mathjax_preview_as_code.html +4 -0
  25. data/test/testcases/block/15_math/mathjax_preview_as_code.options +3 -0
  26. data/test/testcases/block/15_math/mathjax_preview_as_code.text +5 -0
  27. data/test/testcases/man/example.man +123 -0
  28. data/test/testcases/man/example.text +85 -0
  29. data/test/testcases/man/heading-name-dash-description.man +4 -0
  30. data/test/testcases/man/heading-name-dash-description.text +1 -0
  31. data/test/testcases/man/heading-name-description.man +4 -0
  32. data/test/testcases/man/heading-name-description.text +2 -0
  33. data/test/testcases/man/heading-name-section-description.man +4 -0
  34. data/test/testcases/man/heading-name-section-description.text +1 -0
  35. data/test/testcases/man/heading-name-section.man +2 -0
  36. data/test/testcases/man/heading-name-section.text +1 -0
  37. data/test/testcases/man/heading-name.man +2 -0
  38. data/test/testcases/man/heading-name.text +1 -0
  39. data/test/testcases/man/sections.man +4 -0
  40. data/test/testcases/man/sections.text +11 -0
  41. data/test/testcases/man/text-escaping.man +8 -0
  42. data/test/testcases/man/text-escaping.text +7 -0
  43. data/test/testcases/span/text_substitutions/typography.html +2 -0
  44. data/test/testcases/span/text_substitutions/typography.text +2 -0
  45. data/test/testcases_gfm/codeblock_fenced.html +20 -0
  46. data/test/testcases_gfm/codeblock_fenced.options +1 -0
  47. data/test/testcases_gfm/codeblock_fenced.text +21 -0
  48. data/test/testcases_gfm/header_ids.html +17 -0
  49. data/test/testcases_gfm/header_ids.html.19 +17 -0
  50. data/test/testcases_gfm/header_ids.options +1 -0
  51. data/test/testcases_gfm/header_ids.text +17 -0
  52. data/test/testcases_gfm/header_ids_with_prefix.html +3 -0
  53. data/test/testcases_gfm/header_ids_with_prefix.options +2 -0
  54. data/test/testcases_gfm/header_ids_with_prefix.text +3 -0
  55. metadata +34 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d6f21a2a725bc5ab410d5402155cb27018d6edec
4
- data.tar.gz: eaae19e9a6f514b79947e72fa76b2f6ab8f3a51b
3
+ metadata.gz: 43bc5045b25aa10da98437d9749b2fcd36fa437d
4
+ data.tar.gz: d4722f2fed6ffec6ae48323dab8535e56c868352
5
5
  SHA512:
6
- metadata.gz: 519e94399dbcfa7acb14b77078e39f7db120b6c10da0510e0d7ad6754fb158cf96923f592ad4ec12ff11861eb2dd73585257e9dd6eed27eacb47bebb32c0aaae
7
- data.tar.gz: 715a23901826864e7fc25aa93dd3566222931d3d22b5ecdb92db20e0cc4fd454cdae729d01004c18088f8398f9a88d5e2cbea3c05ef2d13bcc79afc34f50185a
6
+ metadata.gz: b796ad05a36b9618dceb6934e56998cd578051f03c22710e6fb33567b63af5082870ca0e697199e4bd0ac3291b79692e48d93562823ca8ba9723bf57c24e5f88
7
+ data.tar.gz: 9c62ce1f4c087f3dc3b3e60fe61cdf39f1dfdb82a6974440fe61a289941a2fe35d0fdbf1391a8be2d38b90409c9a3346f37d5a3450307e2e4f8ce496f3110d1e
@@ -1,8 +1,9 @@
1
1
  Count Name
2
2
  ======= ====
3
- 816 Thomas Leitner <t_leitner@gmx.at>
3
+ 827 Thomas Leitner <t_leitner@gmx.at>
4
4
  6 Gioele Barabucci <gioele@svario.it>
5
5
  4 Ted Pak <powerpak006@gmail.com>
6
+ 4 Shuanglei Tao <tsl0922@gmail.com>
6
7
  4 Arne Brasseur <arne@arnebrasseur.net>
7
8
  3 Henning Perl <perl@fast-sicher.de>
8
9
  3 gettalong <t_leitner@gmx.at>
@@ -10,7 +11,6 @@
10
11
  3 Ben Armston <ben.armston@googlemail.com>
11
12
  3 Alex Marandon <contact@alexmarandon.com>
12
13
  2 Tom Thorogood <me+github@tomthorogood.co.uk>
13
- 2 Shuanglei Tao <tsl0922@gmail.com>
14
14
  2 Parker Moore <parkrmoore@gmail.com>
15
15
  2 Nathanael Jones <nathanael.jones@gmail.com>
16
16
  2 Max Meyer <dev@fedux.org>
@@ -40,6 +40,7 @@
40
40
  1 Joe Fiorini <joe@faithfulgeek.org>
41
41
  1 Jens Kraemer <jk@jkraemer.net>
42
42
  1 Hector Correa <hector@hectorcorrea.com>
43
+ 1 Florian Klampfer <f.klampfer@gmail.com>
43
44
  1 Floreal Morandat florealm@gmail.com <florealm@gmail.com>
44
45
  1 Diego Galeota <diegobg123@gmail.com>
45
46
  1 Damien Pollet <damien.pollet@gmail.com>
data/README.md CHANGED
@@ -60,10 +60,10 @@ kramdown Wiki at <https://github.com/gettalong/kramdown/wiki>.
60
60
  ## Development
61
61
 
62
62
  Just clone the git repository as described in **doc/installation.page** and you are good to go. You
63
- probably want to install `rake` so that you can use the provided rake tasks. Aside from that:
63
+ probably want to install `rake` so that you can use the provided rake tasks.
64
64
 
65
- * The `tidy` binary needs to be installed for the automatically derived tests to work.
66
- * The `latex` binary needs to be installed for the latex-compilation tests to work.
65
+ If you want to run the tests, the development dependencies are needed as well as some additional
66
+ programs like `tidy` and `latex`. See the `.travis.yml` file for more information.
67
67
 
68
68
 
69
69
  ## License
data/Rakefile CHANGED
@@ -149,7 +149,8 @@ EOF
149
149
  file 'man/man1/kramdown.1' => ['man/man1/kramdown.1.erb'] do
150
150
  puts "Generating kramdown man page"
151
151
  File.open('man/man1/kramdown.1', 'w+') do |file|
152
- file.write(ERB.new(File.read('man/man1/kramdown.1.erb')).result(binding))
152
+ data = ERB.new(File.read('man/man1/kramdown.1.erb')).result(binding)
153
+ file.write(Kramdown::Document.new(data).to_man)
153
154
  end
154
155
  end
155
156
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.12.0
1
+ 1.13.0
@@ -21,8 +21,10 @@ OptionParser.new do |opts|
21
21
  opts.separator "Command line options:"
22
22
  opts.separator ""
23
23
 
24
- opts.on("-i", "--input ARG", "Specify the input format: kramdown (default), html, GFM or markdown") {|v| options[:input] = v}
25
- opts.on("-o", "--output ARG", Array, "Specify one or more output formats separated by commas: html (default), kramdown, latex, pdf or remove_html_tags") {|v| format = v}
24
+ opts.on("-i", "--input ARG", "Specify the input format: kramdown (default), " \
25
+ "html, GFM or markdown") {|v| options[:input] = v}
26
+ opts.on("-o", "--output ARG", Array, "Specify one or more output formats separated by commas: " \
27
+ "html (default),", "kramdown, latex, pdf, man or remove_html_tags") {|v| format = v}
26
28
 
27
29
  opts.on("-v", "--version", "Show the version of kramdown") do
28
30
  puts Kramdown::VERSION
@@ -9,6 +9,7 @@
9
9
  * Converters
10
10
  * [HTML](converter/html.html)
11
11
  * [LaTeX](converter/latex.html)
12
+ * [man](converter/man.html)
12
13
  * [kramdown](converter/kramdown.html)
13
14
  * [RemoveHtmlTags](converter/remove_html_tags.html)
14
15
  * Syntax Highlighters
@@ -97,8 +97,8 @@ extensions that have been made popular by the [PHP Markdown Extra] package and [
97
97
  It is probably the fastest pure-Ruby Markdown converter available (September 2014), being about 3x
98
98
  faster than [Maruku] and about 4.5x faster than [BlueFeather].
99
99
 
100
- Version **1.12.0**{:itemprop="softwareVersion"} released on
101
- **2016-08-15**{:itemprop="datePublished"}, [more news](news.html)
100
+ Version **1.13.0**{:itemprop="softwareVersion"} released on
101
+ **2016-11-20**{:itemprop="datePublished"}, [more news](news.html)
102
102
  {: style="text-align: center; font-size: 80%"}
103
103
 
104
104
  </div>
@@ -787,10 +787,10 @@ There are four different line types that can be used in a table:
787
787
 
788
788
  * *Separator lines* are used to split the table body into multiple body parts.
789
789
 
790
- A separator line is any line that contains only pipes, dashes, pluses, colons and spaces and which
791
- contains at least one dash and one pipe character. The pipe and plus characters can be used to
792
- visually separate columns although this is not needed. Multiple separator lines after another are
793
- treated as one separator line.
790
+ A separator line is any line that contains only pipes, dashes, pluses, colons and spaces/tabs and
791
+ which contains at least one dash and one pipe character. The pipe and plus characters can be used
792
+ to visually separate columns although this is not needed. Multiple separator lines after another
793
+ are treated as one separator line.
794
794
 
795
795
  Here are some example separator lines:
796
796
 
@@ -806,9 +806,9 @@ There are four different line types that can be used in a table:
806
806
  alignments. All table rows above the header separator line are considered to be header rows.
807
807
 
808
808
  The header separator line can be specially formatted to contain column alignment definitions: An
809
- alignment definition consists of an optional space followed by an optional colon, one or more
810
- dashes, an optional colon and another optional space. The colons of an alignment definition are
811
- used to set the alignment of a column: if there are no colons, the column uses the default
809
+ alignment definition consists of an optional space/tab followed by an optional colon, one or more
810
+ dashes, an optional colon and another optional space/tab. The colons of an alignment definition
811
+ are used to set the alignment of a column: if there are no colons, the column uses the default
812
812
  alignment, if there is a colon only before the dashes, the column is left aligned, if there are
813
813
  colons before and after the dashes, the column is center aligned and if there is only a colon
814
814
  after the dashes, the column is right aligned. Each alignment definition sets the alignment for
@@ -27,6 +27,7 @@ module Kramdown
27
27
  autoload :RemoveHtmlTags, 'kramdown/converter/remove_html_tags'
28
28
  autoload :Pdf, 'kramdown/converter/pdf'
29
29
  autoload :HashAST, 'kramdown/converter/hash_ast'
30
+ autoload :Man, 'kramdown/converter/man'
30
31
 
31
32
  extend ::Kramdown::Utils::Configurable
32
33
 
@@ -0,0 +1,303 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ #--
4
+ # Copyright (C) 2009-2016 Thomas Leitner <t_leitner@gmx.at>
5
+ #
6
+ # This file is part of kramdown which is licensed under the MIT.
7
+ #++
8
+ #
9
+
10
+ require 'kramdown/converter'
11
+
12
+ module Kramdown
13
+
14
+ module Converter
15
+
16
+ # Converts a Kramdown::Document to a manpage in groff format. See man(7), groff_man(7) and
17
+ # man-pages(7) for information regarding the output.
18
+ class Man < Base
19
+
20
+ def convert(el, opts = {:indent => 0, :result => ''}) #:nodoc:
21
+ send("convert_#{el.type}", el, opts)
22
+ end
23
+
24
+ private
25
+
26
+ def inner(el, opts, use = :all)
27
+ arr = el.children.reject {|e| e.type == :blank}
28
+ arr.each_with_index do |inner_el, index|
29
+ next if use == :rest && index == 0
30
+ break if use == :first && index > 0
31
+ options = opts.dup
32
+ options[:parent] = el
33
+ options[:index] = index
34
+ options[:prev] = (index == 0 ? nil : arr[index - 1])
35
+ options[:next] = (index == arr.length - 1 ? nil : arr[index + 1])
36
+ convert(inner_el, options)
37
+ end
38
+ end
39
+
40
+ def convert_root(el, opts)
41
+ @title_done = false
42
+ opts[:result] = ".\\\" generated by kramdown\n"
43
+ inner(el, opts)
44
+ opts[:result]
45
+ end
46
+
47
+ def convert_blank(*)
48
+ end
49
+ alias :convert_hr :convert_blank
50
+ alias :convert_xml_pi :convert_blank
51
+
52
+ def convert_p(el, opts)
53
+ if (opts[:index] != 0 && opts[:prev].type != :header) ||
54
+ (opts[:parent].type == :blockquote && opts[:index] == 0)
55
+ opts[:result] << macro("P")
56
+ end
57
+ inner(el, opts)
58
+ newline(opts[:result])
59
+ end
60
+
61
+ def convert_header(el, opts)
62
+ return unless opts[:parent].type == :root
63
+ case el.options[:level]
64
+ when 1
65
+ unless @title_done
66
+ @title_done = true
67
+ data = el.options[:raw_text].scan(/([^(]+)\s*\((\d\w*)\)(?:\s*-+\s*(.*))?/).first ||
68
+ el.options[:raw_text].scan(/([^\s]+)\s*(?:-*\s+)?()(.*)/).first
69
+ return unless data && data[0]
70
+ name = data[0]
71
+ section = (data[1].to_s.empty? ? el.attr['data-section'] || '7' : data[1])
72
+ description = (data[2].to_s.empty? ? nil : " - #{data[2]}")
73
+ date = el.attr['data-date'] ? quote(el.attr['data-date']) : nil
74
+ extra = (el.attr['data-extra'] ? quote(escape(el.attr['data-extra'].to_s)) : nil)
75
+ opts[:result] << macro("TH", quote(escape(name.upcase)), quote(section), date, extra)
76
+ if description
77
+ opts[:result] << macro("SH", "NAME") << escape("#{name}#{description}") << "\n"
78
+ end
79
+ end
80
+ when 2
81
+ opts[:result] << macro("SH", quote(escape(el.options[:raw_text])))
82
+ when 3
83
+ opts[:result] << macro("SS", quote(escape(el.options[:raw_text])))
84
+ else
85
+ warning("Header levels greater than three are not supported")
86
+ end
87
+ end
88
+
89
+ def convert_codeblock(el, opts)
90
+ opts[:result] << macro("sp") << macro("RS", 4) << macro("EX")
91
+ opts[:result] << newline(escape(el.value, true))
92
+ opts[:result] << macro("EE") << macro("RE")
93
+ end
94
+
95
+ def convert_blockquote(el, opts)
96
+ opts[:result] << macro("RS")
97
+ inner(el, opts)
98
+ opts[:result] << macro("RE")
99
+ end
100
+
101
+ def convert_ul(el, opts)
102
+ compact = (el.attr['class'] =~ /\bcompact\b/)
103
+ opts[:result] << macro("sp") << macro("PD", 0) if compact
104
+ inner(el, opts)
105
+ opts[:result] << macro("PD") if compact
106
+ end
107
+ alias :convert_dl :convert_ul
108
+ alias :convert_ol :convert_ul
109
+
110
+ def convert_li(el, opts)
111
+ sym = (opts[:parent].type == :ul ? '\(bu' : "#{opts[:index] + 1}.")
112
+ opts[:result] << macro("IP", sym, 4)
113
+ inner(el, opts, :first)
114
+ if el.children.size > 1
115
+ opts[:result] << macro("RS")
116
+ inner(el, opts, :rest)
117
+ opts[:result] << macro("RE")
118
+ end
119
+ end
120
+
121
+ def convert_dt(el, opts)
122
+ opts[:result] << macro(opts[:prev] && opts[:prev].type == :dt ? "TQ" : "TP")
123
+ inner(el, opts)
124
+ opts[:result] << "\n"
125
+ end
126
+
127
+ def convert_dd(el, opts)
128
+ inner(el, opts, :first)
129
+ if el.children.size > 1
130
+ opts[:result] << macro("RS")
131
+ inner(el, opts, :rest)
132
+ opts[:result] << macro("RE")
133
+ end
134
+ opts[:result] << macro("sp") if opts[:next] && opts[:next].type == :dd
135
+ end
136
+
137
+ TABLE_CELL_ALIGNMENT = {:left => 'l', :center => 'c', :right => 'r', :default => 'l'}
138
+
139
+ def convert_table(el, opts)
140
+ opts[:alignment] = el.options[:alignment].map {|a| TABLE_CELL_ALIGNMENT[a]}
141
+ table_options = ["box"]
142
+ table_options << "center" if el.attr['class'] =~ /\bcenter\b/
143
+ opts[:result] << macro("TS") << "#{table_options.join(" ")} ;\n"
144
+ inner(el, opts)
145
+ opts[:result] << macro("TE") << macro("sp")
146
+ end
147
+
148
+ def convert_thead(el, opts)
149
+ opts[:result] << opts[:alignment].map {|a| "#{a}b"}.join(' ') << " .\n"
150
+ inner(el, opts)
151
+ opts[:result] << "=\n"
152
+ end
153
+
154
+ def convert_tbody(el, opts)
155
+ opts[:result] << ".T&\n" if opts[:index] != 0
156
+ opts[:result] << opts[:alignment].join(' ') << " .\n"
157
+ inner(el, opts)
158
+ opts[:result] << (opts[:next].type == :tfoot ? "=\n" : "_\n") if opts[:next]
159
+ end
160
+
161
+ def convert_tfoot(el, opts)
162
+ inner(el, opts)
163
+ end
164
+
165
+ def convert_tr(el, opts)
166
+ inner(el, opts)
167
+ opts[:result] << "\n"
168
+ end
169
+
170
+ def convert_td(el, opts)
171
+ result = opts[:result]
172
+ opts[:result] = ''
173
+ inner(el, opts)
174
+ if opts[:result] =~ /\n/
175
+ warning("Table cells using links are not supported")
176
+ result << "\t"
177
+ else
178
+ result << opts[:result] << "\t"
179
+ end
180
+ end
181
+
182
+ def convert_html_element(*)
183
+ warning("HTML elements are not supported")
184
+ end
185
+
186
+ def convert_xml_comment(el, opts)
187
+ newline(opts[:result]) << ".\"#{escape(el.value, true).rstrip.gsub(/\n/, "\n.\"")}\n"
188
+ end
189
+ alias :convert_comment :convert_xml_comment
190
+
191
+
192
+ def convert_a(el, opts)
193
+ if el.children.size == 1 && el.children[0].type == :text &&
194
+ el.attr['href'] == el.children[0].value
195
+ newline(opts[:result]) << macro("UR", escape(el.attr['href'])) << macro("UE")
196
+ elsif el.attr['href'].start_with?('mailto:')
197
+ newline(opts[:result]) << macro("MT", escape(el.attr['href'].sub(/^mailto:/, ''))) <<
198
+ macro("UE")
199
+ else
200
+ newline(opts[:result]) << macro("UR", escape(el.attr['href']))
201
+ inner(el, opts)
202
+ newline(opts[:result]) << macro("UE")
203
+ end
204
+ end
205
+
206
+ def convert_img(el, opts)
207
+ warning("Images are not supported")
208
+ end
209
+
210
+ def convert_em(el, opts)
211
+ opts[:result] << '\fI'
212
+ inner(el, opts)
213
+ opts[:result] << '\fP'
214
+ end
215
+
216
+ def convert_strong(el, opts)
217
+ opts[:result] << '\fB'
218
+ inner(el, opts)
219
+ opts[:result] << '\fP'
220
+ end
221
+
222
+ def convert_codespan(el, opts)
223
+ opts[:result] << "\\fB#{escape(el.value)}\\fP"
224
+ end
225
+
226
+ def convert_br(el, opts)
227
+ newline(opts[:result]) << macro("br")
228
+ end
229
+
230
+ def convert_abbreviation(el, opts)
231
+ opts[:result] << escape(el.value)
232
+ end
233
+
234
+ def convert_math(el, opts)
235
+ if el.options[:category] == :block
236
+ convert_codeblock(el, opts)
237
+ else
238
+ convert_codespan(el, opts)
239
+ end
240
+ end
241
+
242
+ def convert_footnote(*)
243
+ warning("Footnotes are not supported")
244
+ end
245
+
246
+ def convert_raw(*)
247
+ warning("Raw content is not supported")
248
+ end
249
+
250
+
251
+
252
+ def convert_text(el, opts)
253
+ text = escape(el.value)
254
+ text.lstrip! if opts[:result][-1] == ?\n
255
+ opts[:result] << text
256
+ end
257
+
258
+ def convert_entity(el, opts)
259
+ opts[:result] << unicode_char(el.value.code_point)
260
+ end
261
+
262
+ def convert_smart_quote(el, opts)
263
+ opts[:result] << unicode_char(::Kramdown::Utils::Entities.entity(el.value.to_s).code_point)
264
+ end
265
+
266
+ TYPOGRAPHIC_SYMS_MAP = {
267
+ :mdash => '\(em', :ndash => '\(em', :hellip => '\.\.\.',
268
+ :laquo_space => '\[Fo]', :raquo_space => '\[Fc]', :laquo => '\[Fo]', :raquo => '\[Fc]'
269
+ }
270
+
271
+ def convert_typographic_sym(el, opts)
272
+ opts[:result] << TYPOGRAPHIC_SYMS_MAP[el.value]
273
+ end
274
+
275
+ def macro(name, *args)
276
+ ".#{[name, *args].compact.join(' ')}\n"
277
+ end
278
+
279
+ def newline(text)
280
+ text << "\n" unless text[-1] == ?\n
281
+ text
282
+ end
283
+
284
+ def quote(text)
285
+ "\"#{text.gsub(/"/, '\\"')}\""
286
+ end
287
+
288
+ def escape(text, preserve_whitespace = false)
289
+ text = (preserve_whitespace ? text.dup : text.gsub(/\s+/, ' '))
290
+ text.gsub!('\\', "\\e")
291
+ text.gsub!(/^\./, '\\\\&.')
292
+ text.gsub!(/[.'-]/) {|m| "\\#{m}"}
293
+ text
294
+ end
295
+
296
+ def unicode_char(codepoint)
297
+ "\\[u#{codepoint.to_s(16).rjust(4, '0')}]"
298
+ end
299
+
300
+ end
301
+
302
+ end
303
+ end
@@ -36,10 +36,20 @@ module Kramdown::Converter::MathEngine
36
36
 
37
37
  preview = (preview == true ? converter.escape_html(el.value) : preview.to_s)
38
38
 
39
+ preview_as_code = converter.options[:math_engine_opts][:preview_as_code]
40
+
39
41
  if el.options[:category] == :block
40
- converter.format_as_block_html('div', {'class' => 'MathJax_Preview'}, preview, opts[:indent])
42
+ if preview_as_code
43
+ converter.format_as_block_html('pre', {'class' => 'MathJax_Preview'},
44
+ converter.format_as_span_html('code', {}, preview),
45
+ opts[:indent])
46
+ else
47
+ converter.format_as_block_html('div', {'class' => 'MathJax_Preview'}, preview,
48
+ opts[:indent])
49
+ end
41
50
  else
42
- converter.format_as_span_html('span', {'class' => 'MathJax_Preview'}, preview)
51
+ converter.format_as_span_html(preview_as_code ? 'code' : 'span',
52
+ {'class' => 'MathJax_Preview'}, preview)
43
53
  end
44
54
  end
45
55