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
@@ -16,6 +16,9 @@ module Kramdown
16
16
 
17
17
  def initialize(source, options)
18
18
  super
19
+ @options[:auto_id_stripping] = true
20
+ @id_counter = Hash.new(-1)
21
+
19
22
  @span_parsers.delete(:line_break) if @options[:hard_wrap]
20
23
  if @options[:gfm_quirks].include?(:paragraph_end)
21
24
  atx_header_parser = :atx_header_gfm_quirk
@@ -39,12 +42,12 @@ module Kramdown
39
42
 
40
43
  def parse
41
44
  super
42
- add_hard_line_breaks(@root) if @options[:hard_wrap]
45
+ update_elements(@root)
43
46
  end
44
47
 
45
- def add_hard_line_breaks(element)
48
+ def update_elements(element)
46
49
  element.children.map! do |child|
47
- if child.type == :text && child.value =~ /\n/
50
+ if child.type == :text && @options[:hard_wrap] && child.value =~ /\n/
48
51
  children = []
49
52
  lines = child.value.split(/\n/, -1)
50
53
  omit_trailing_br = (Kramdown::Element.category(element) == :block && element.children[-1] == child &&
@@ -59,13 +62,27 @@ module Kramdown
59
62
  children
60
63
  elsif child.type == :html_element
61
64
  child
65
+ elsif child.type == :header && @options[:auto_ids] && !child.attr.has_key?('id')
66
+ child.attr['id'] = generate_gfm_header_id(child.options[:raw_text])
67
+ child
62
68
  else
63
- add_hard_line_breaks(child)
69
+ update_elements(child)
64
70
  child
65
71
  end
66
72
  end.flatten!
67
73
  end
68
74
 
75
+ NON_WORD_RE = (RUBY_VERSION > "1.9" ? /[^\p{Word}\- \t]/ : /[^\w\- \t]/)
76
+
77
+ def generate_gfm_header_id(text)
78
+ result = text.downcase
79
+ result.gsub!(NON_WORD_RE, '')
80
+ result.tr!(" \t", '-')
81
+ @id_counter[result] += 1
82
+ result << (@id_counter[result] > 0 ? "-#{@id_counter[result]}" : '')
83
+ @options[:auto_id_prefix] + result
84
+ end
85
+
69
86
  ATX_HEADER_START = /^\#{1,6}\s/
70
87
  define_parser(:atx_header_gfm, ATX_HEADER_START, nil, 'parse_atx_header')
71
88
  define_parser(:atx_header_gfm_quirk, ATX_HEADER_START)
@@ -85,8 +102,8 @@ module Kramdown
85
102
  true
86
103
  end
87
104
 
88
- FENCED_CODEBLOCK_START = /^[~`]{3,}/
89
- FENCED_CODEBLOCK_MATCH = /^(([~`]){3,})\s*?((\S+?)(?:\?\S*)?)?\s*?\n(.*?)^\1\2*\s*?\n/m
105
+ FENCED_CODEBLOCK_START = /^[ ]{0,3}[~`]{3,}/
106
+ FENCED_CODEBLOCK_MATCH = /^[ ]{0,3}(([~`]){3,})\s*?((\S+?)(?:\?\S*)?)?\s*?\n(.*?)^[ ]{0,3}\1\2*\s*?\n/m
90
107
  define_parser(:codeblock_fenced_gfm, FENCED_CODEBLOCK_START, nil, 'parse_codeblock_fenced')
91
108
 
92
109
  STRIKETHROUGH_DELIM = /~~/
@@ -84,10 +84,12 @@ module Kramdown
84
84
  item.value = [item.value]
85
85
  elsif (result = @src.scan(content_re)) || (!last_is_blank && (result = @src.scan(lazy_re)))
86
86
  result.sub!(/^(\t+)/) { " " * 4 * $1.length }
87
- result.sub!(indent_re, '')
88
- if !nested_list_found && result =~ LIST_START
87
+ indentation_found = result.sub!(indent_re, '')
88
+ if !nested_list_found && indentation_found && result =~ LIST_START
89
89
  item.value << ''
90
90
  nested_list_found = true
91
+ elsif nested_list_found && !indentation_found && result =~ LIST_START
92
+ result = " " * (indentation + 4) << result
91
93
  end
92
94
  item.value.last << result
93
95
  last_is_blank = false
@@ -136,7 +136,7 @@ module Kramdown
136
136
  # Single/double closing quotes:
137
137
  [/(#{SQ_CLOSE})('|")/, [1, :rquote2]],
138
138
  # Special case for e.g. "<i>Custer</i>'s Last Stand."
139
- [/("|')(\s|s\b|$)/, [:rquote1, 2]],
139
+ [/("|')(?=\s|s\b|$)/, [:rquote1]],
140
140
  # Any remaining single quotes should be opening ones:
141
141
  [/(.?)'/m, [1, :lsquo]],
142
142
  [/(.?)"/m, [1, :ldquo]],
@@ -13,9 +13,9 @@ module Kramdown
13
13
  module Parser
14
14
  class Kramdown
15
15
 
16
- TABLE_SEP_LINE = /^([+|: -]*?-[+|: -]*?)[ \t]*\n/
17
- TABLE_HSEP_ALIGN = /[ ]?(:?)-+(:?)[ ]?/
18
- TABLE_FSEP_LINE = /^[+|: =]*?=[+|: =]*?[ \t]*\n/
16
+ TABLE_SEP_LINE = /^([+|: \t-]*?-[+|: \t-]*?)[ \t]*\n/
17
+ TABLE_HSEP_ALIGN = /[ \t]?(:?)-+(:?)[ \t]?/
18
+ TABLE_FSEP_LINE = /^[+|: \t=]*?=[+|: \t=]*?[ \t]*\n/
19
19
  TABLE_ROW_LINE = /^(.*?)[ \t]*\n/
20
20
  TABLE_PIPE_CHECK = /(?:\||.*?[^\\\n]\|)/
21
21
  TABLE_LINE = /#{TABLE_PIPE_CHECK}.*?\n/
@@ -10,6 +10,6 @@
10
10
  module Kramdown
11
11
 
12
12
  # The kramdown version.
13
- VERSION = '1.12.0'
13
+ VERSION = '1.13.0'
14
14
 
15
15
  end
@@ -1,508 +1,368 @@
1
- .TH "KRAMDOWN" 1 "February 2015"
1
+ .\" generated by kramdown
2
+ .TH "KRAMDOWN" "1" "November 2016"
2
3
  .SH NAME
3
- kramdown \- a fast, pure-Ruby Markdown-superset converter
4
- .SH SYNOPSIS
5
- .B kramdown
6
- [\fIoptions\fR]
7
- [\fIFILE\fR ...]
8
- .SH DESCRIPTION
9
- kramdown is primarily used for parsing a superset of Markdown and converting it to different output
10
- formats. It supports standard Markdown (with some minor modifications) and various extensions like
11
- tables and definition lists. Due to its modular architecture it also allows other input formats than
12
- Markdown, for example, HTML or Github Flavored Markdown.
13
-
14
- If \fIFILE\fR is not specified, kramdown reads from the standard input. The result is written to the
15
- standard output.
16
-
17
- There are two sets of options that kramdown accepts: The first one includes the options that are
18
- used directly by the kramdown binary. The second set of options controls how kramdown parses and
19
- converts its input.
20
- .SH OPTIONS
21
- .TP
22
- .B \-i, \-\-input ARG
23
- Specify the input format. Available input formats: kramdown (this is the default), markdown, GFM or html.
24
- .TP
25
- .B \-o, \-\-output ARG
26
- Specify one or more output formats separated by commas: html (default), kramdown, latex, pdf or
27
- remove_html_tags.
28
- .TP
29
- .B \-v, \-\-version
30
- Show the version of kramdown.
31
- .TP
32
- .B \-h, \-\-help
33
- Show the help.
34
-
35
- .SH KRAMDOWN OPTIONS
36
-
37
- .TP
38
- .B \-\-auto-id-prefix ARG
39
-
4
+ kramdown \- a fast, pure\-Ruby Markdown\-superset converter
5
+ .SH "SYNOPSIS"
6
+ \fBkramdown\fP [\fIoptions\fP] [\fIFILE\fP\.\.\.]
7
+ .SH "DESCRIPTION"
8
+ kramdown is primarily used for parsing a superset of Markdown and converting it to different output formats\. It supports standard Markdown (with some minor modifications) and various extensions like tables and definition lists\. Due to its modular architecture it also allows other input formats than Markdown, for example, HTML or Github Flavored Markdown\.
9
+ .P
10
+ If \fIFILE\fP is not specified, kramdown reads from the standard input\. The result is written to the standard output\.
11
+ .P
12
+ There are two sets of options that kramdown accepts: The first one includes the options that are used directly by the kramdown binary\. The second set of options controls how kramdown parses and converts its input\.
13
+ .SH "CLI\-ONLY OPTIONS"
14
+ .TP
15
+ \fB\-i\fP \fIFORMAT\fP, \fB\-\-input\fP \fIFORMAT\fP
16
+ Specify the input format\. Available input formats: \fIkramdown\fP (this is the default), \fImarkdown\fP, \fIGFM\fP or \fIhtml\fP\&\.
17
+ .TP
18
+ \fB\-o\fP \fIFORMAT\fP, \fB\-\-output\fP \fIFORMAT\fP
19
+ Specify one or more output formats separated by commas: \fIhtml\fP (default), \fIkramdown\fP, \fIlatex\fP, \fIpdf\fP, \fIman\fP or \fIremove_html_tags\fP\&\.
20
+ .TP
21
+ \fB\-v\fP, \fB\-\-version\fP
22
+ Show the version of kramdown\.
23
+ .TP
24
+ \fB\-h\fP, \fB\-\-help\fP
25
+ Show the help\.
26
+ .SH "KRAMDOWN OPTIONS"
27
+ .TP
28
+ \fB\-\-auto\-id\-prefix\fP \fIARG\fP
40
29
  Prefix used for automatically generated header IDs
41
-
42
- This option can be used to set a prefix for the automatically generated
43
- header IDs so that there is no conflict when rendering multiple kramdown
44
- documents into one output file separately. The prefix should only
45
- contain characters that are valid in an ID!
46
-
47
- Default: ''
48
- Used by: HTML/Latex converter
49
-
50
-
51
- .TP
52
- .B \-\-[no\-]auto-id-stripping
53
-
30
+ .RS
31
+ .P
32
+ This option can be used to set a prefix for the automatically generated header IDs so that there is no conflict when rendering multiple kramdown documents into one output file separately\. The prefix should only contain characters that are valid in an ID!
33
+ .P
34
+ Default: \[u2018]\[u2019] Used by: HTML/Latex converter
35
+ .RE
36
+ .TP
37
+ \fB\-\-[no\-]auto\-id\-stripping\fP
54
38
  Strip all formatting from header text for automatic ID generation
55
-
56
- If this option is `true`, only the text elements of a header are used
57
- for generating the ID later (in contrast to just using the raw header
58
- text line).
59
-
60
- This option will be removed in version 2.0 because this will be the
61
- default then.
62
-
63
- Default: false
64
- Used by: kramdown parser
65
-
66
-
67
- .TP
68
- .B \-\-[no\-]auto-ids
69
-
39
+ .RS
40
+ .P
41
+ If this option is \fBtrue\fP, only the text elements of a header are used for generating the ID later (in contrast to just using the raw header text line)\.
42
+ .P
43
+ This option will be removed in version 2\.0 because this will be the default then\.
44
+ .P
45
+ Default: false Used by: kramdown parser
46
+ .RE
47
+ .TP
48
+ \fB\-\-[no\-]auto\-ids\fP
70
49
  Use automatic header ID generation
71
-
72
- If this option is `true`, ID values for all headers are automatically
73
- generated if no ID is explicitly specified.
74
-
75
- Default: true
76
- Used by: HTML/Latex converter
77
-
78
-
79
- .TP
80
- .B \-\-coderay-bold-every ARG
81
-
50
+ .RS
51
+ .P
52
+ If this option is \fBtrue\fP, ID values for all headers are automatically generated if no ID is explicitly specified\.
53
+ .P
54
+ Default: true Used by: HTML/Latex converter
55
+ .RE
56
+ .TP
57
+ \fB\-\-coderay\-bold\-every\fP \fIARG\fP
82
58
  Defines how often a line number should be made bold
83
-
84
- Can either be an integer or false (to turn off bold line numbers
85
- completely).
86
-
87
- Default: 10
88
- Used by: HTML converter
89
-
90
-
91
- .TP
92
- .B \-\-coderay-css ARG
93
-
59
+ .RS
60
+ .P
61
+ Can either be an integer or false (to turn off bold line numbers completely)\.
62
+ .P
63
+ Default: 10 Used by: HTML converter
64
+ .RE
65
+ .TP
66
+ \fB\-\-coderay\-css\fP \fIARG\fP
94
67
  Defines how the highlighted code gets styled
95
-
96
- Possible values are :class (CSS classes are applied to the code
97
- elements, one must supply the needed CSS file) or :style (default CSS
98
- styles are directly applied to the code elements).
99
-
100
- Default: style
101
- Used by: HTML converter
102
-
103
-
104
- .TP
105
- .B \-\-coderay-default-lang ARG
106
-
68
+ .RS
69
+ .P
70
+ Possible values are :class (CSS classes are applied to the code elements, one must supply the needed CSS file) or :style (default CSS styles are directly applied to the code elements)\.
71
+ .P
72
+ Default: style Used by: HTML converter
73
+ .RE
74
+ .TP
75
+ \fB\-\-coderay\-default\-lang\fP \fIARG\fP
107
76
  Sets the default language for highlighting code blocks
108
-
109
- If no language is set for a code block, the default language is used
110
- instead. The value has to be one of the languages supported by coderay
111
- or nil if no default language should be used.
112
-
113
- Default: nil
114
- Used by: HTML converter
115
-
116
-
117
- .TP
118
- .B \-\-coderay-line-number-start ARG
119
-
77
+ .RS
78
+ .P
79
+ If no language is set for a code block, the default language is used instead\. The value has to be one of the languages supported by coderay or nil if no default language should be used\.
80
+ .P
81
+ Default: nil Used by: HTML converter
82
+ .RE
83
+ .TP
84
+ \fB\-\-coderay\-line\-number\-start\fP \fIARG\fP
120
85
  The start value for the line numbers
121
-
122
- Default: 1
123
- Used by: HTML converter
124
-
125
-
86
+ .RS
87
+ .P
88
+ Default: 1 Used by: HTML converter
89
+ .RE
126
90
  .TP
127
- .B \-\-coderay-line-numbers ARG
128
-
91
+ \fB\-\-coderay\-line\-numbers\fP \fIARG\fP
129
92
  Defines how and if line numbers should be shown
130
-
131
- The possible values are :table, :inline or nil. If this option is
132
- nil, no line numbers are shown.
133
-
134
- Default: :inline
135
- Used by: HTML converter
136
-
137
-
138
- .TP
139
- .B \-\-coderay-tab-width ARG
140
-
93
+ .RS
94
+ .P
95
+ The possible values are :table, :inline or nil\. If this option is nil, no line numbers are shown\.
96
+ .P
97
+ Default: :inline Used by: HTML converter
98
+ .RE
99
+ .TP
100
+ \fB\-\-coderay\-tab\-width\fP \fIARG\fP
141
101
  The tab width used in highlighted code
142
-
102
+ .RS
103
+ .P
143
104
  Used by: HTML converter
144
-
145
-
105
+ .RE
146
106
  .TP
147
- .B \-\-coderay-wrap ARG
148
-
107
+ \fB\-\-coderay\-wrap\fP \fIARG\fP
149
108
  Defines how the highlighted code should be wrapped
150
-
151
- The possible values are :span, :div or nil.
152
-
153
- Default: :div
154
- Used by: HTML converter
155
-
156
-
157
- .TP
158
- .B \-\-[no\-]enable-coderay
159
-
109
+ .RS
110
+ .P
111
+ The possible values are :span, :div or nil\.
112
+ .P
113
+ Default: :div Used by: HTML converter
114
+ .RE
115
+ .TP
116
+ \fB\-\-[no\-]enable\-coderay\fP
160
117
  Use coderay for syntax highlighting
161
-
162
- If this option is `true`, coderay is used by the HTML converter for
163
- syntax highlighting the content of code spans and code blocks.
164
-
165
- Default: true
166
- Used by: HTML converter
167
-
168
-
169
- .TP
170
- .B \-\-entity-output ARG
171
-
118
+ .RS
119
+ .P
120
+ If this option is \fBtrue\fP, coderay is used by the HTML converter for syntax highlighting the content of code spans and code blocks\.
121
+ .P
122
+ Default: true Used by: HTML converter
123
+ .RE
124
+ .TP
125
+ \fB\-\-entity\-output\fP \fIARG\fP
172
126
  Defines how entities are output
173
-
174
- The possible values are :as_input (entities are output in the same
175
- form as found in the input), :numeric (entities are output in numeric
176
- form), :symbolic (entities are output in symbolic form if possible) or
177
- :as_char (entities are output as characters if possible, only available
178
- on Ruby 1.9).
179
-
180
- Default: :as_char
181
- Used by: HTML converter, kramdown converter
182
-
183
-
184
- .TP
185
- .B \-\-footnote-backlink ARG
186
-
127
+ .RS
128
+ .P
129
+ The possible values are :as_input (entities are output in the same form as found in the input), :numeric (entities are output in numeric form), :symbolic (entities are output in symbolic form if possible) or :as_char (entities are output as characters if possible, only available on Ruby 1\.9)\.
130
+ .P
131
+ Default: :as_char Used by: HTML converter, kramdown converter
132
+ .RE
133
+ .TP
134
+ \fB\-\-footnote\-backlink\fP \fIARG\fP
187
135
  Defines the text that should be used for the footnote backlinks
188
-
189
- The footnote backlink is just text, so any special HTML characters will
190
- be escaped.
191
-
192
- If the footnote backlint text is an empty string, no footnote backlinks
193
- will be generated.
194
-
195
- Default: '&8617;'
196
- Used by: HTML converter
197
-
198
-
199
- .TP
200
- .B \-\-footnote-nr ARG
201
-
136
+ .RS
137
+ .P
138
+ The footnote backlink is just text, so any special HTML characters will be escaped\.
139
+ .P
140
+ If the footnote backlint text is an empty string, no footnote backlinks will be generated\.
141
+ .P
142
+ Default: \[u2018]\[u0026]8617;\[u2019] Used by: HTML converter
143
+ .RE
144
+ .TP
145
+ \fB\-\-footnote\-nr\fP \fIARG\fP
202
146
  The number of the first footnote
203
-
204
- This option can be used to specify the number that is used for the first
205
- footnote.
206
-
207
- Default: 1
208
- Used by: HTML converter
209
-
210
-
211
- .TP
212
- .B \-\-gfm-quirks ARG
213
-
147
+ .RS
148
+ .P
149
+ This option can be used to specify the number that is used for the first footnote\.
150
+ .P
151
+ Default: 1 Used by: HTML converter
152
+ .RE
153
+ .TP
154
+ \fB\-\-gfm\-quirks\fP \fIARG\fP
214
155
  Enables a set of GFM specific quirks
215
-
216
- The way how GFM is transformed on Github often differs from the way
217
- kramdown does things. Many of these differences are negligible but
218
- others are not.
219
-
220
- This option allows one to enable/disable certain GFM quirks, i.e. ways
221
- in which GFM parsing differs from kramdown parsing.
222
-
223
- The value has to be a list of quirk names that should be enabled,
224
- separated by commas. Possible names are:
225
-
226
- * paragraph_end
227
-
228
- Disables the kramdown restriction that at least one blank line has to
229
- be used after a paragraph before a new block element can be started.
230
-
231
- Note that if this quirk is used, lazy line wrapping does not fully
232
- work anymore!
233
-
234
- Default: paragraph_end
235
- Used by: GFM parser
236
-
237
-
238
- .TP
239
- .B \-\-[no\-]hard-wrap
240
-
156
+ .RS
157
+ .P
158
+ The way how GFM is transformed on Github often differs from the way kramdown does things\. Many of these differences are negligible but others are not\.
159
+ .P
160
+ This option allows one to enable/disable certain GFM quirks, i\.e\. ways in which GFM parsing differs from kramdown parsing\.
161
+ .P
162
+ The value has to be a list of quirk names that should be enabled, separated by commas\. Possible names are:
163
+ .IP \(bu 4
164
+ paragraph_end
165
+ .RS
166
+ .P
167
+ Disables the kramdown restriction that at least one blank line has to be used after a paragraph before a new block element can be started\.
168
+ .P
169
+ Note that if this quirk is used, lazy line wrapping does not fully work anymore!
170
+ .RE
171
+ .P
172
+ Default: paragraph_end Used by: GFM parser
173
+ .RE
174
+ .TP
175
+ \fB\-\-[no\-]hard\-wrap\fP
241
176
  Interprets line breaks literally
242
-
243
- Insert HTML `<br />` tags inside paragraphs where the original Markdown
244
- document had newlines (by default, Markdown ignores these newlines).
245
-
246
- Default: true
247
- Used by: GFM parser
248
-
249
-
250
- .TP
251
- .B \-\-header-offset ARG
252
-
177
+ .RS
178
+ .P
179
+ Insert HTML \fB<br />\fP tags inside paragraphs where the original Markdown document had newlines (by default, Markdown ignores these newlines)\.
180
+ .P
181
+ Default: true Used by: GFM parser
182
+ .RE
183
+ .TP
184
+ \fB\-\-header\-offset\fP \fIARG\fP
253
185
  Sets the output offset for headers
254
-
255
- If this option is c (may also be negative) then a header with level n
256
- will be output as a header with level c+n. If c+n is lower than 1,
257
- level 1 will be used. If c+n is greater than 6, level 6 will be used.
258
-
259
- Default: 0
260
- Used by: HTML converter, Kramdown converter, Latex converter
261
-
262
-
263
- .TP
264
- .B \-\-[no\-]html-to-native
265
-
186
+ .RS
187
+ .P
188
+ If this option is c (may also be negative) then a header with level n will be output as a header with level c+n\. If c+n is lower than 1, level 1 will be used\. If c+n is greater than 6, level 6 will be used\.
189
+ .P
190
+ Default: 0 Used by: HTML converter, Kramdown converter, Latex converter
191
+ .RE
192
+ .TP
193
+ \fB\-\-[no\-]html\-to\-native\fP
266
194
  Convert HTML elements to native elements
267
-
268
- If this option is `true`, the parser converts HTML elements to native
269
- elements. For example, when parsing `<em>hallo</em>` the emphasis tag
270
- would normally be converted to an `:html` element with tag type `:em`.
271
- If `html_to_native` is `true`, then the emphasis would be converted to a
272
- native `:em` element.
273
-
274
- This is useful for converters that cannot deal with HTML elements.
275
-
276
- Default: false
277
- Used by: kramdown parser
278
-
279
-
280
- .TP
281
- .B \-\-latex-headers ARG
282
-
195
+ .RS
196
+ .P
197
+ If this option is \fBtrue\fP, the parser converts HTML elements to native elements\. For example, when parsing \fB<em>hallo</em>\fP the emphasis tag would normally be converted to an \fB:html\fP element with tag type \fB:em\fP\&\. If \fBhtml_to_native\fP is \fBtrue\fP, then the emphasis would be converted to a native \fB:em\fP element\.
198
+ .P
199
+ This is useful for converters that cannot deal with HTML elements\.
200
+ .P
201
+ Default: false Used by: kramdown parser
202
+ .RE
203
+ .TP
204
+ \fB\-\-latex\-headers\fP \fIARG\fP
283
205
  Defines the LaTeX commands for different header levels
284
-
285
- The commands for the header levels one to six can be specified by
286
- separating them with commas.
287
-
288
- Default: section,subsection,subsubsection,paragraph,subparagraph,subparagraph
289
- Used by: Latex converter
290
-
291
-
292
- .TP
293
- .B \-\-line-width ARG
294
-
206
+ .RS
207
+ .P
208
+ The commands for the header levels one to six can be specified by separating them with commas\.
209
+ .P
210
+ Default: section,subsection,subsubsection,paragraph,subparagraph,subparagraph Used by: Latex converter
211
+ .RE
212
+ .TP
213
+ \fB\-\-line\-width\fP \fIARG\fP
295
214
  Defines the line width to be used when outputting a document
296
-
297
- Default: 72
298
- Used by: kramdown converter
299
-
300
-
301
- .TP
302
- .B \-\-link-defs ARG
303
-
304
- Pre-defines link definitions
305
-
306
- This option can be used to pre-define link definitions. The value needs
307
- to be a Hash where the keys are the link identifiers and the values are
308
- two element Arrays with the link URL and the link title.
309
-
310
- If the value is a String, it has to contain a valid YAML hash and the
311
- hash has to follow the above guidelines.
312
-
313
- Default: {}
314
- Used by: kramdown parser
315
-
316
-
317
- .TP
318
- .B \-\-math-engine ARG
319
-
215
+ .RS
216
+ .P
217
+ Default: 72 Used by: kramdown converter
218
+ .RE
219
+ .TP
220
+ \fB\-\-link\-defs\fP \fIARG\fP
221
+ Pre\-defines link definitions
222
+ .RS
223
+ .P
224
+ This option can be used to pre\-define link definitions\. The value needs to be a Hash where the keys are the link identifiers and the values are two element Arrays with the link URL and the link title\.
225
+ .P
226
+ If the value is a String, it has to contain a valid YAML hash and the hash has to follow the above guidelines\.
227
+ .P
228
+ Default: {} Used by: kramdown parser
229
+ .RE
230
+ .TP
231
+ \fB\-\-math\-engine\fP \fIARG\fP
320
232
  Set the math engine
321
-
322
- Specifies the math engine that should be used for converting math
323
- blocks/spans. If this option is set to +nil+, no math engine is used and
324
- the math blocks/spans are output as is.
325
-
326
- Options for the selected math engine can be set with the
327
- math_engine_opts configuration option.
328
-
329
- Default: mathjax
330
- Used by: HTML converter
331
-
332
-
333
- .TP
334
- .B \-\-math-engine-opts ARG
335
-
233
+ .RS
234
+ .P
235
+ Specifies the math engine that should be used for converting math blocks/spans\. If this option is set to +nil+, no math engine is used and the math blocks/spans are output as is\.
236
+ .P
237
+ Options for the selected math engine can be set with the math_engine_opts configuration option\.
238
+ .P
239
+ Default: mathjax Used by: HTML converter
240
+ .RE
241
+ .TP
242
+ \fB\-\-math\-engine\-opts\fP \fIARG\fP
336
243
  Set the math engine options
337
-
338
- Specifies options for the math engine set via the math_engine
339
- configuration option.
340
-
341
- The value needs to be a hash with key-value pairs that are understood by
342
- the used math engine.
343
-
344
- Default: {}
345
- Used by: HTML converter
346
-
347
-
348
- .TP
349
- .B \-\-[no\-]parse-block-html
350
-
244
+ .RS
245
+ .P
246
+ Specifies options for the math engine set via the math_engine configuration option\.
247
+ .P
248
+ The value needs to be a hash with key\-value pairs that are understood by the used math engine\.
249
+ .P
250
+ Default: {} Used by: HTML converter
251
+ .RE
252
+ .TP
253
+ \fB\-\-[no\-]parse\-block\-html\fP
351
254
  Process kramdown syntax in block HTML tags
352
-
353
- If this option is `true`, the kramdown parser processes the content of
354
- block HTML tags as text containing block-level elements. Since this is
355
- not wanted normally, the default is `false`. It is normally better to
356
- selectively enable kramdown processing via the markdown attribute.
357
-
358
- Default: false
359
- Used by: kramdown parser
360
-
361
-
362
- .TP
363
- .B \-\-[no\-]parse-span-html
364
-
255
+ .RS
256
+ .P
257
+ If this option is \fBtrue\fP, the kramdown parser processes the content of block HTML tags as text containing block\-level elements\. Since this is not wanted normally, the default is \fBfalse\fP\&\. It is normally better to selectively enable kramdown processing via the markdown attribute\.
258
+ .P
259
+ Default: false Used by: kramdown parser
260
+ .RE
261
+ .TP
262
+ \fB\-\-[no\-]parse\-span\-html\fP
365
263
  Process kramdown syntax in span HTML tags
366
-
367
- If this option is `true`, the kramdown parser processes the content of
368
- span HTML tags as text containing span-level elements.
369
-
370
- Default: true
371
- Used by: kramdown parser
372
-
373
-
374
- .TP
375
- .B \-\-[no\-]remove-block-html-tags
376
-
264
+ .RS
265
+ .P
266
+ If this option is \fBtrue\fP, the kramdown parser processes the content of span HTML tags as text containing span\-level elements\.
267
+ .P
268
+ Default: true Used by: kramdown parser
269
+ .RE
270
+ .TP
271
+ \fB\-\-[no\-]remove\-block\-html\-tags\fP
377
272
  Remove block HTML tags
378
-
379
- If this option is `true`, the RemoveHtmlTags converter removes
380
- block HTML tags.
381
-
382
- Default: true
383
- Used by: RemoveHtmlTags converter
384
-
385
-
386
- .TP
387
- .B \-\-[no\-]remove-span-html-tags
388
-
273
+ .RS
274
+ .P
275
+ If this option is \fBtrue\fP, the RemoveHtmlTags converter removes block HTML tags\.
276
+ .P
277
+ Default: true Used by: RemoveHtmlTags converter
278
+ .RE
279
+ .TP
280
+ \fB\-\-[no\-]remove\-span\-html\-tags\fP
389
281
  Remove span HTML tags
390
-
391
- If this option is `true`, the RemoveHtmlTags converter removes
392
- span HTML tags.
393
-
394
- Default: false
395
- Used by: RemoveHtmlTags converter
396
-
397
-
398
- .TP
399
- .B \-\-smart-quotes ARG
400
-
282
+ .RS
283
+ .P
284
+ If this option is \fBtrue\fP, the RemoveHtmlTags converter removes span HTML tags\.
285
+ .P
286
+ Default: false Used by: RemoveHtmlTags converter
287
+ .RE
288
+ .TP
289
+ \fB\-\-smart\-quotes\fP \fIARG\fP
401
290
  Defines the HTML entity names or code points for smart quote output
402
-
403
- The entities identified by entity name or code point that should be
404
- used for, in order, a left single quote, a right single quote, a left
405
- double and a right double quote are specified by separating them with
406
- commas.
407
-
408
- Default: lsquo,rsquo,ldquo,rdquo
409
- Used by: HTML/Latex converter
410
-
411
-
412
- .TP
413
- .B \-\-syntax-highlighter ARG
414
-
291
+ .RS
292
+ .P
293
+ The entities identified by entity name or code point that should be used for, in order, a left single quote, a right single quote, a left double and a right double quote are specified by separating them with commas\.
294
+ .P
295
+ Default: lsquo,rsquo,ldquo,rdquo Used by: HTML/Latex converter
296
+ .RE
297
+ .TP
298
+ \fB\-\-syntax\-highlighter\fP \fIARG\fP
415
299
  Set the syntax highlighter
416
-
417
- Specifies the syntax highlighter that should be used for highlighting
418
- code blocks and spans. If this option is set to +nil+, no syntax
419
- highlighting is done.
420
-
421
- Options for the syntax highlighter can be set with the
422
- syntax_highlighter_opts configuration option.
423
-
424
- Default: coderay
425
- Used by: HTML/Latex converter
426
-
427
-
428
- .TP
429
- .B \-\-syntax-highlighter-opts ARG
430
-
300
+ .RS
301
+ .P
302
+ Specifies the syntax highlighter that should be used for highlighting code blocks and spans\. If this option is set to +nil+, no syntax highlighting is done\.
303
+ .P
304
+ Options for the syntax highlighter can be set with the syntax_highlighter_opts configuration option\.
305
+ .P
306
+ Default: coderay Used by: HTML/Latex converter
307
+ .RE
308
+ .TP
309
+ \fB\-\-syntax\-highlighter\-opts\fP \fIARG\fP
431
310
  Set the syntax highlighter options
432
-
433
- Specifies options for the syntax highlighter set via the
434
- syntax_highlighter configuration option.
435
-
436
- The value needs to be a hash with key-value pairs that are understood by
437
- the used syntax highlighter.
438
-
439
- Default: {}
440
- Used by: HTML/Latex converter
441
-
442
-
443
- .TP
444
- .B \-\-template ARG
445
-
446
- The name of an ERB template file that should be used to wrap the output
447
- or the ERB template itself.
448
-
449
- This is used to wrap the output in an environment so that the output can
450
- be used as a stand-alone document. For example, an HTML template would
451
- provide the needed header and body tags so that the whole output is a
452
- valid HTML file. If no template is specified, the output will be just
453
- the converted text.
454
-
455
- When resolving the template file, the given template name is used first.
456
- If such a file is not found, the converter extension (the same as the
457
- converter name) is appended. If the file still cannot be found, the
458
- templates name is interpreted as a template name that is provided by
459
- kramdown (without the converter extension). If the file is still not
460
- found, the template name is checked if it starts with 'string://' and if
461
- it does, this prefix is removed and the rest is used as template
462
- content.
463
-
464
- kramdown provides a default template named 'document' for each converter.
465
-
466
- Default: ''
467
- Used by: all converters
468
-
469
-
470
- .TP
471
- .B \-\-toc-levels ARG
472
-
311
+ .RS
312
+ .P
313
+ Specifies options for the syntax highlighter set via the syntax_highlighter configuration option\.
314
+ .P
315
+ The value needs to be a hash with key\-value pairs that are understood by the used syntax highlighter\.
316
+ .P
317
+ Default: {} Used by: HTML/Latex converter
318
+ .RE
319
+ .TP
320
+ \fB\-\-template\fP \fIARG\fP
321
+ The name of an ERB template file that should be used to wrap the output or the ERB template itself\.
322
+ .RS
323
+ .P
324
+ This is used to wrap the output in an environment so that the output can be used as a stand\-alone document\. For example, an HTML template would provide the needed header and body tags so that the whole output is a valid HTML file\. If no template is specified, the output will be just the converted text\.
325
+ .P
326
+ When resolving the template file, the given template name is used first\. If such a file is not found, the converter extension (the same as the converter name) is appended\. If the file still cannot be found, the templates name is interpreted as a template name that is provided by kramdown (without the converter extension)\. If the file is still not found, the template name is checked if it starts with \[u2018]string://\[u2019] and if it does, this prefix is removed and the rest is used as template content\.
327
+ .P
328
+ kramdown provides a default template named \[u2018]document\[u2019] for each converter\.
329
+ .P
330
+ Default: \[u2018]\[u2019] Used by: all converters
331
+ .RE
332
+ .TP
333
+ \fB\-\-toc\-levels\fP \fIARG\fP
473
334
  Defines the levels that are used for the table of contents
474
-
475
- The individual levels can be specified by separating them with commas
476
- (e.g. 1,2,3) or by using the range syntax (e.g. 1..3). Only the
477
- specified levels are used for the table of contents.
478
-
479
- Default: 1..6
480
- Used by: HTML/Latex converter
481
-
482
-
483
- .TP
484
- .B \-\-[no\-]transliterated-header-ids
485
-
335
+ .RS
336
+ .P
337
+ The individual levels can be specified by separating them with commas (e\.g\. 1,2,3) or by using the range syntax (e\.g\. 1\.\.3)\. Only the specified levels are used for the table of contents\.
338
+ .P
339
+ Default: 1\.\.6 Used by: HTML/Latex converter
340
+ .RE
341
+ .TP
342
+ \fB\-\-[no\-]transliterated\-header\-ids\fP
486
343
  Transliterate the header text before generating the ID
487
-
488
- Only ASCII characters are used in headers IDs. This is not good for
489
- languages with many non-ASCII characters. By enabling this option
490
- the header text is transliterated to ASCII as good as possible so that
491
- the resulting header ID is more useful.
492
-
344
+ .RS
345
+ .P
346
+ Only ASCII characters are used in headers IDs\. This is not good for languages with many non\-ASCII characters\. By enabling this option the header text is transliterated to ASCII as good as possible so that the resulting header ID is more useful\.
347
+ .P
493
348
  The stringex library needs to be installed for this feature to work!
494
-
495
- Default: false
496
- Used by: HTML/Latex converter
497
-
498
-
499
- .SH EXIT STATUS
500
- The exit status is 0 if no error happened. Otherwise it is 1.
501
- .SH SEE ALSO
502
- The kramdown website, http://kramdown.gettalong.org/ for more information, especially on the supported
503
- input syntax.
504
- .SH AUTHOR
505
- kramdown was written by Thomas Leitner <t_leitner@gmx.at>.
506
- .PP
507
- This manual page was written by Thomas Leitner <t_leitner@gmx.at>.
508
-
349
+ .P
350
+ Default: false Used by: HTML/Latex converter
351
+ .RE
352
+ .SH "EXIT STATUS"
353
+ The exit status is 0 if no error happened\. Otherwise it is 1\.
354
+ .SH "SEE ALSO"
355
+ The kramdown website
356
+ .UR http://kramdown\.gettalong\.org
357
+ .UE
358
+ for more information, especially on the supported input syntax\.
359
+ .SH "AUTHOR"
360
+ kramdown was written by Thomas Leitner
361
+ .MT t_leitner@gmx\.at
362
+ .UE
363
+ \&\.
364
+ .P
365
+ This manual page was written by Thomas Leitner
366
+ .MT t_leitner@gmx\.at
367
+ .UE
368
+ \&\.