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.
- checksums.yaml +4 -4
- data/CONTRIBUTERS +3 -2
- data/README.md +3 -3
- data/Rakefile +2 -1
- data/VERSION +1 -1
- data/bin/kramdown +4 -2
- data/doc/documentation.template +1 -0
- data/doc/index.page +2 -2
- data/doc/syntax.page +7 -7
- data/lib/kramdown/converter.rb +1 -0
- data/lib/kramdown/converter/man.rb +303 -0
- data/lib/kramdown/converter/math_engine/mathjax.rb +12 -2
- data/lib/kramdown/parser/gfm.rb +23 -6
- data/lib/kramdown/parser/kramdown/list.rb +4 -2
- data/lib/kramdown/parser/kramdown/smart_quotes.rb +1 -1
- data/lib/kramdown/parser/kramdown/table.rb +3 -3
- data/lib/kramdown/version.rb +1 -1
- data/man/man1/kramdown.1 +332 -472
- data/test/test_files.rb +15 -0
- data/test/testcases/block/08_list/lazy_and_nested.html +9 -0
- data/test/testcases/block/08_list/lazy_and_nested.text +4 -0
- data/test/testcases/block/14_table/header.html +21 -0
- data/test/testcases/block/14_table/header.text +7 -0
- data/test/testcases/block/15_math/mathjax_preview_as_code.html +4 -0
- data/test/testcases/block/15_math/mathjax_preview_as_code.options +3 -0
- data/test/testcases/block/15_math/mathjax_preview_as_code.text +5 -0
- data/test/testcases/man/example.man +123 -0
- data/test/testcases/man/example.text +85 -0
- data/test/testcases/man/heading-name-dash-description.man +4 -0
- data/test/testcases/man/heading-name-dash-description.text +1 -0
- data/test/testcases/man/heading-name-description.man +4 -0
- data/test/testcases/man/heading-name-description.text +2 -0
- data/test/testcases/man/heading-name-section-description.man +4 -0
- data/test/testcases/man/heading-name-section-description.text +1 -0
- data/test/testcases/man/heading-name-section.man +2 -0
- data/test/testcases/man/heading-name-section.text +1 -0
- data/test/testcases/man/heading-name.man +2 -0
- data/test/testcases/man/heading-name.text +1 -0
- data/test/testcases/man/sections.man +4 -0
- data/test/testcases/man/sections.text +11 -0
- data/test/testcases/man/text-escaping.man +8 -0
- data/test/testcases/man/text-escaping.text +7 -0
- data/test/testcases/span/text_substitutions/typography.html +2 -0
- data/test/testcases/span/text_substitutions/typography.text +2 -0
- data/test/testcases_gfm/codeblock_fenced.html +20 -0
- data/test/testcases_gfm/codeblock_fenced.options +1 -0
- data/test/testcases_gfm/codeblock_fenced.text +21 -0
- data/test/testcases_gfm/header_ids.html +17 -0
- data/test/testcases_gfm/header_ids.html.19 +17 -0
- data/test/testcases_gfm/header_ids.options +1 -0
- data/test/testcases_gfm/header_ids.text +17 -0
- data/test/testcases_gfm/header_ids_with_prefix.html +3 -0
- data/test/testcases_gfm/header_ids_with_prefix.options +2 -0
- data/test/testcases_gfm/header_ids_with_prefix.text +3 -0
- metadata +34 -2
data/lib/kramdown/parser/gfm.rb
CHANGED
@@ -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
|
-
|
45
|
+
update_elements(@root)
|
43
46
|
end
|
44
47
|
|
45
|
-
def
|
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
|
-
|
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(.*?)
|
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
|
-
[/("|')(
|
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/
|
data/lib/kramdown/version.rb
CHANGED
data/man/man1/kramdown.1
CHANGED
@@ -1,508 +1,368 @@
|
|
1
|
-
|
1
|
+
.\" generated by kramdown
|
2
|
+
.TH "KRAMDOWN" "1" "November 2016"
|
2
3
|
.SH NAME
|
3
|
-
kramdown \- a fast, pure
|
4
|
-
.SH SYNOPSIS
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
.
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
.
|
23
|
-
|
24
|
-
|
25
|
-
.
|
26
|
-
|
27
|
-
|
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
|
-
|
43
|
-
header IDs so that there is no conflict when rendering multiple kramdown
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
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
|
-
|
57
|
-
for generating the ID later (in contrast to just using the raw header
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
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
|
-
|
73
|
-
generated if no ID is explicitly specified
|
74
|
-
|
75
|
-
Default: true
|
76
|
-
|
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
|
-
|
85
|
-
completely)
|
86
|
-
|
87
|
-
Default: 10
|
88
|
-
|
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
|
-
|
97
|
-
elements, one must supply the needed CSS file) or :style (default CSS
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
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
|
-
|
110
|
-
instead
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
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
|
-
|
123
|
-
Used by: HTML converter
|
124
|
-
|
125
|
-
|
86
|
+
.RS
|
87
|
+
.P
|
88
|
+
Default: 1 Used by: HTML converter
|
89
|
+
.RE
|
126
90
|
.TP
|
127
|
-
|
128
|
-
|
91
|
+
\fB\-\-coderay\-line\-numbers\fP \fIARG\fP
|
129
92
|
Defines how and if line numbers should be shown
|
130
|
-
|
131
|
-
|
132
|
-
nil, no line numbers are shown
|
133
|
-
|
134
|
-
Default: :inline
|
135
|
-
|
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
|
-
|
148
|
-
|
107
|
+
\fB\-\-coderay\-wrap\fP \fIARG\fP
|
149
108
|
Defines how the highlighted code should be wrapped
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
Used by: HTML converter
|
155
|
-
|
156
|
-
|
157
|
-
|
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
|
-
|
163
|
-
syntax highlighting the content of code spans and code blocks
|
164
|
-
|
165
|
-
Default: true
|
166
|
-
|
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
|
-
|
175
|
-
form as found in the input), :numeric (entities are output in numeric
|
176
|
-
|
177
|
-
:as_char
|
178
|
-
|
179
|
-
|
180
|
-
|
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
|
-
|
190
|
-
be escaped
|
191
|
-
|
192
|
-
If the footnote backlint text is an empty string, no footnote backlinks
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
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
|
-
|
205
|
-
footnote
|
206
|
-
|
207
|
-
Default: 1
|
208
|
-
|
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
|
-
|
217
|
-
kramdown does things
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
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
|
-
|
244
|
-
document had newlines (by default, Markdown ignores these newlines)
|
245
|
-
|
246
|
-
Default: true
|
247
|
-
|
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
|
-
|
256
|
-
will be output as a header with level c+n
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
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
|
-
|
269
|
-
elements
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
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
|
-
|
286
|
-
separating them with commas
|
287
|
-
|
288
|
-
Default: section,subsection,subsubsection,paragraph,subparagraph,subparagraph
|
289
|
-
|
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
|
-
|
298
|
-
Used by: kramdown converter
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
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
|
-
|
323
|
-
blocks/spans
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
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
|
-
|
339
|
-
configuration option
|
340
|
-
|
341
|
-
The value needs to be a hash with key
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
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
|
-
|
354
|
-
block HTML tags as text containing block
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
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
|
-
|
368
|
-
span HTML tags as text containing span
|
369
|
-
|
370
|
-
Default: true
|
371
|
-
|
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
|
-
|
380
|
-
block HTML tags
|
381
|
-
|
382
|
-
Default: true
|
383
|
-
|
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
|
-
|
392
|
-
span HTML tags
|
393
|
-
|
394
|
-
Default: false
|
395
|
-
|
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
|
-
|
404
|
-
used for, in order, a left single quote, a right single quote, a left
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
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
|
-
|
418
|
-
code blocks and spans
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
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
|
-
|
434
|
-
syntax_highlighter configuration option
|
435
|
-
|
436
|
-
The value needs to be a hash with key
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
.
|
444
|
-
.
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
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
|
-
|
476
|
-
(e
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
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
|
-
|
489
|
-
languages with many non
|
490
|
-
|
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
|
-
|
497
|
-
|
498
|
-
|
499
|
-
.SH
|
500
|
-
The
|
501
|
-
.
|
502
|
-
|
503
|
-
input syntax
|
504
|
-
.SH AUTHOR
|
505
|
-
kramdown was written by Thomas Leitner
|
506
|
-
.
|
507
|
-
|
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
|
+
\&\.
|