kramdown 1.6.0 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of kramdown might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CONTRIBUTERS +4 -1
- data/VERSION +1 -1
- data/bin/kramdown +1 -1
- data/doc/documentation.template +1 -0
- data/doc/index.page +2 -2
- data/doc/syntax.page +5 -6
- data/lib/kramdown/converter.rb +4 -7
- data/lib/kramdown/converter/base.rb +3 -3
- data/lib/kramdown/converter/latex.rb +14 -2
- data/lib/kramdown/converter/math_engine/mathjaxnode.rb +48 -0
- data/lib/kramdown/converter/syntax_highlighter/coderay.rb +1 -1
- data/lib/kramdown/converter/syntax_highlighter/minted.rb +35 -0
- data/lib/kramdown/options.rb +2 -2
- data/lib/kramdown/parser/gfm.rb +1 -1
- data/lib/kramdown/parser/html.rb +2 -2
- data/lib/kramdown/parser/kramdown/codeblock.rb +1 -1
- data/lib/kramdown/parser/kramdown/link.rb +2 -1
- data/lib/kramdown/utils/configurable.rb +1 -1
- data/lib/kramdown/version.rb +1 -1
- data/man/man1/kramdown.1 +197 -197
- data/test/test_files.rb +13 -0
- data/test/test_location.rb +5 -0
- data/test/testcases/block/06_codeblock/highlighting-minted-with-opts.latex +9 -0
- data/test/testcases/block/06_codeblock/highlighting-minted-with-opts.options +4 -0
- data/test/testcases/block/06_codeblock/highlighting-minted-with-opts.text +5 -0
- data/test/testcases/block/06_codeblock/highlighting-minted.latex +8 -0
- data/test/testcases/block/06_codeblock/highlighting-minted.options +3 -0
- data/test/testcases/block/06_codeblock/highlighting-minted.text +4 -0
- data/test/testcases/block/06_codeblock/with_lang_in_fenced_block_name_with_dash.html +3 -0
- data/test/testcases/block/06_codeblock/with_lang_in_fenced_block_name_with_dash.options +2 -0
- data/test/testcases/block/06_codeblock/with_lang_in_fenced_block_name_with_dash.text +4 -0
- data/test/testcases/block/15_math/mathjaxnode.html.19 +27 -0
- data/test/testcases/block/15_math/mathjaxnode.options +1 -0
- data/test/testcases/block/15_math/mathjaxnode.text +1 -0
- data/test/testcases/block/15_math/mathjaxnode_notexhints.html.19 +23 -0
- data/test/testcases/block/15_math/mathjaxnode_notexhints.options +3 -0
- data/test/testcases/block/15_math/mathjaxnode_notexhints.text +1 -0
- data/test/testcases/block/15_math/mathjaxnode_semantics.html.19 +32 -0
- data/test/testcases/block/15_math/mathjaxnode_semantics.options +3 -0
- data/test/testcases/block/15_math/mathjaxnode_semantics.text +1 -0
- data/test/testcases/span/01_link/link_defs.html +1 -1
- data/test/testcases/span/01_link/link_defs.text +2 -1
- data/test/testcases/span/03_codespan/highlighting-minted.latex +2 -0
- data/test/testcases/span/03_codespan/highlighting-minted.options +1 -0
- data/test/testcases/span/03_codespan/highlighting-minted.text +1 -0
- data/test/testcases/span/math/mathjaxnode.html.19 +27 -0
- data/test/testcases/span/math/mathjaxnode.options +1 -0
- data/test/testcases/span/math/mathjaxnode.text +1 -0
- metadata +29 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28967ed8b0da11707a43ff1e7e92eb844d472fd0
|
4
|
+
data.tar.gz: dcf6f6dcf3f06e7bbf0c6fe90f326e380466b29b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4736e9a72ae7c194704ea5e7870e0bee43161794d2f71c071df0def49933578e02fabd72c4c02ba80b70f045fce748cb494c83a40ff915511bd7c8a39036a6d5
|
7
|
+
data.tar.gz: 86304867c51dcaa09e446701d88d975cdfada7d998d6051bd2479defda8d8ef1c0d9c2f3b74f3fce0ee17832e8d6785574a694f39fe063e6347ceeb24c245cf4
|
data/CONTRIBUTERS
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Count Name
|
2
2
|
======= ====
|
3
|
-
|
3
|
+
763 Thomas Leitner <t_leitner@gmx.at>
|
4
4
|
6 Gioele Barabucci <gioele@svario.it>
|
5
5
|
4 Ted Pak <powerpak006@gmail.com>
|
6
6
|
4 Arne Brasseur <arne@arnebrasseur.net>
|
@@ -10,12 +10,14 @@
|
|
10
10
|
3 Ben Armston <ben.armston@googlemail.com>
|
11
11
|
3 Alex Marandon <contact@alexmarandon.com>
|
12
12
|
2 Nathanael Jones <nathanael.jones@gmail.com>
|
13
|
+
2 Max Meyer <dev@fedux.org>
|
13
14
|
2 Jo Hund <jhund@clearcove.ca>
|
14
15
|
2 Bran <m.versum@gmail.com>
|
15
16
|
1 winniehell <git@winniehell.de>
|
16
17
|
1 utenmiki <utenmiki@gmail.com>
|
17
18
|
1 Trevor Wennblom <trevor@well.com>
|
18
19
|
1 tomykaira <tomykaira@gmail.com>
|
20
|
+
1 Tom Thorogood <me+github@tomthorogood.co.uk>
|
19
21
|
1 Tim Blair <tim@bla.ir>
|
20
22
|
1 Tim Besard <tim.besard@gmail.com>
|
21
23
|
1 Tim Bates <tim@rumpuslabs.com>
|
@@ -29,6 +31,7 @@
|
|
29
31
|
1 Matt Hickford <matt.hickford@gmail.com>
|
30
32
|
1 Marcus Stollsteimer <sto.mar@web.de>
|
31
33
|
1 Luca Barbato <luca.barbato@gmail.com>
|
34
|
+
1 l3kn <hello@l3kn.de>
|
32
35
|
1 John Croisant <jacius@gmail.com>
|
33
36
|
1 Joe Fiorini <joe@faithfulgeek.org>
|
34
37
|
1 Jens Kraemer <jk@jkraemer.net>
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.7.0
|
data/bin/kramdown
CHANGED
@@ -37,7 +37,7 @@ OptionParser.new do |opts|
|
|
37
37
|
opts.separator "kramdown options:"
|
38
38
|
opts.separator ""
|
39
39
|
|
40
|
-
Kramdown::Options.definitions.each do |n, definition|
|
40
|
+
Kramdown::Options.definitions.sort.each do |n, definition|
|
41
41
|
no = n.to_s.tr('_', '-')
|
42
42
|
if definition.type == Kramdown::Options::Boolean
|
43
43
|
opts.on("--[no-]#{no}") {|v| options[n] = Kramdown::Options.parse(n, v)}
|
data/doc/documentation.template
CHANGED
data/doc/index.page
CHANGED
@@ -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.
|
101
|
-
**2015-
|
100
|
+
Version **1.7.0**{:itemprop="softwareVersion"} released on
|
101
|
+
**2015-04-27**{:itemprop="datePublished"}, [more news](news.html)
|
102
102
|
{: style="text-align: center; font-size: 80%"}
|
103
103
|
|
104
104
|
</div>
|
data/doc/syntax.page
CHANGED
@@ -1150,9 +1150,8 @@ Notes:
|
|
1150
1150
|
However, if you use square brackets within the link text, you have to either properly nest them or
|
1151
1151
|
to escape them. It is not possible to create nested links!
|
1152
1152
|
|
1153
|
-
* The link URL
|
1154
|
-
|
1155
|
-
(incorrectly nested parentheses are allowed).
|
1153
|
+
* The link URL has to contain properly nested parentheses if no title is specified, or the link URL
|
1154
|
+
must be contained in angle brackets (incorrectly nested parentheses are allowed).
|
1156
1155
|
|
1157
1156
|
* The link title may not contain its delimiters and may not be empty.
|
1158
1157
|
|
@@ -1194,9 +1193,9 @@ definition looks like this:
|
|
1194
1193
|
The link definition has the following structure:
|
1195
1194
|
|
1196
1195
|
* The link identifier in square brackets, optionally indented up to three spaces,
|
1197
|
-
* then a colon and one or more spaces/tabs,
|
1198
|
-
* then the link URL which must
|
1199
|
-
|
1196
|
+
* then a colon and one or more optional spaces/tabs,
|
1197
|
+
* then the link URL which must contain at least one non-space character, or a left angle bracket,
|
1198
|
+
the link URL and a right angle bracket,
|
1200
1199
|
* then optionally the title in single or double quotes, separated from the link URL by one or more
|
1201
1200
|
spaces or on the next line by itself indented any number of spaces/tabs.
|
1202
1201
|
|
data/lib/kramdown/converter.rb
CHANGED
@@ -31,12 +31,12 @@ module Kramdown
|
|
31
31
|
|
32
32
|
configurable(:syntax_highlighter)
|
33
33
|
|
34
|
-
["Coderay", "Rouge"].each do |klass_name|
|
34
|
+
['Minted', "Coderay", "Rouge"].each do |klass_name|
|
35
35
|
kn_down = klass_name.downcase.intern
|
36
36
|
add_syntax_highlighter(kn_down) do |converter, text, lang, type, opts|
|
37
37
|
require "kramdown/converter/syntax_highlighter/#{kn_down}"
|
38
38
|
klass = ::Kramdown::Utils.deep_const_get("::Kramdown::Converter::SyntaxHighlighter::#{klass_name}")
|
39
|
-
if klass::AVAILABLE
|
39
|
+
if !klass.const_defined?(:AVAILABLE) || klass::AVAILABLE
|
40
40
|
add_syntax_highlighter(kn_down, klass)
|
41
41
|
else
|
42
42
|
add_syntax_highlighter(kn_down) {|*args| nil}
|
@@ -47,15 +47,12 @@ module Kramdown
|
|
47
47
|
|
48
48
|
configurable(:math_engine)
|
49
49
|
|
50
|
-
|
51
|
-
add_math_engine(:mathjax, ::Kramdown::Converter::MathEngine::Mathjax)
|
52
|
-
|
53
|
-
["Ritex", "Itex2MML"].each do |klass_name|
|
50
|
+
['Mathjax', "MathjaxNode", "Ritex", "Itex2MML"].each do |klass_name|
|
54
51
|
kn_down = klass_name.downcase.intern
|
55
52
|
add_math_engine(kn_down) do |converter, el, opts|
|
56
53
|
require "kramdown/converter/math_engine/#{kn_down}"
|
57
54
|
klass = ::Kramdown::Utils.deep_const_get("::Kramdown::Converter::MathEngine::#{klass_name}")
|
58
|
-
if klass::AVAILABLE
|
55
|
+
if !klass.const_defined?(:AVAILABLE) || klass::AVAILABLE
|
59
56
|
add_math_engine(kn_down, klass)
|
60
57
|
else
|
61
58
|
add_math_engine(kn_down) {|*args| nil}
|
@@ -182,8 +182,8 @@ module Kramdown
|
|
182
182
|
|
183
183
|
# Extract the code block/span language from the attributes.
|
184
184
|
def extract_code_language(attr)
|
185
|
-
if attr['class'] && attr['class'] =~ /\blanguage-\w
|
186
|
-
attr['class'].scan(/\blanguage-(\w
|
185
|
+
if attr['class'] && attr['class'] =~ /\blanguage-\w[\w-]*\b/
|
186
|
+
attr['class'].scan(/\blanguage-(\w[\w-]*)\b/).first.first
|
187
187
|
end
|
188
188
|
end
|
189
189
|
|
@@ -192,7 +192,7 @@ module Kramdown
|
|
192
192
|
# *Warning*: This version will modify the given attributes if a language is present.
|
193
193
|
def extract_code_language!(attr)
|
194
194
|
lang = extract_code_language(attr)
|
195
|
-
attr['class'] = attr['class'].sub(/\blanguage-\w
|
195
|
+
attr['class'] = attr['class'].sub(/\blanguage-\w[\w-]*\b/, '').strip if lang
|
196
196
|
attr.delete('class') if lang && attr['class'].empty?
|
197
197
|
lang
|
198
198
|
end
|
@@ -84,7 +84,12 @@ module Kramdown
|
|
84
84
|
def convert_codeblock(el, opts)
|
85
85
|
show_whitespace = el.attr['class'].to_s =~ /\bshow-whitespaces\b/
|
86
86
|
lang = extract_code_language(el.attr)
|
87
|
-
|
87
|
+
|
88
|
+
if @options[:syntax_highlighter] == :minted &&
|
89
|
+
(highlighted_code = highlight_code(el.value, lang, :block))
|
90
|
+
@data[:packages] << 'minted'
|
91
|
+
"#{latex_link_target(el)}#{highlighted_code}\n"
|
92
|
+
elsif show_whitespace || lang
|
88
93
|
options = []
|
89
94
|
options << "showspaces=%s,showtabs=%s" % (show_whitespace ? ['true', 'true'] : ['false', 'false'])
|
90
95
|
options << "language=#{lang}" if lang
|
@@ -226,7 +231,14 @@ module Kramdown
|
|
226
231
|
end
|
227
232
|
|
228
233
|
def convert_codespan(el, opts)
|
229
|
-
|
234
|
+
lang = extract_code_language(el.attr)
|
235
|
+
if @options[:syntax_highlighter] == :minted &&
|
236
|
+
(highlighted_code = highlight_code(el.value, lang, :span))
|
237
|
+
@data[:packages] << 'minted'
|
238
|
+
"#{latex_link_target(el)}#{highlighted_code}"
|
239
|
+
else
|
240
|
+
"{\\tt #{latex_link_target(el)}#{escape(el.value)}}"
|
241
|
+
end
|
230
242
|
end
|
231
243
|
|
232
244
|
def convert_footnote(el, opts)
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
#
|
3
|
+
#--
|
4
|
+
# Copyright (C) 2009-2015 Thomas Leitner <t_leitner@gmx.at>
|
5
|
+
#
|
6
|
+
# This file is part of kramdown which is licensed under the MIT.
|
7
|
+
#++
|
8
|
+
#
|
9
|
+
|
10
|
+
module Kramdown::Converter::MathEngine
|
11
|
+
|
12
|
+
# Uses the MathJax-node library for converting math formulas to MathML.
|
13
|
+
module MathjaxNode
|
14
|
+
|
15
|
+
# MathjaxNode is available if this constant is +true+.
|
16
|
+
AVAILABLE = RUBY_VERSION >= '1.9' && begin
|
17
|
+
npm = %x{npm --global --depth=1 list MathJax-node}
|
18
|
+
|
19
|
+
unless /MathJax-node@/ === npm.lines.drop(1).join("\n")
|
20
|
+
npm = %x{npm --depth=1 list MathJax-node}
|
21
|
+
end
|
22
|
+
|
23
|
+
T2MPATH = File.join(npm.lines.first.strip, "node_modules/MathJax-node/bin/tex2mml")
|
24
|
+
/MathJax-node@/ === npm.lines.drop(1).join("\n") && File.exist?(T2MPATH)
|
25
|
+
rescue
|
26
|
+
false
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.call(converter, el, opts)
|
30
|
+
type = el.options[:category]
|
31
|
+
|
32
|
+
cmd = [T2MPATH]
|
33
|
+
cmd << "--inline" unless type == :block
|
34
|
+
cmd << "--semantics" if converter.options[:math_engine_opts][:semantics] == true
|
35
|
+
cmd << "--notexhints" if converter.options[:math_engine_opts][:texhints] == false
|
36
|
+
result = IO.popen(cmd << el.value).read.strip
|
37
|
+
|
38
|
+
attr = el.attr.dup
|
39
|
+
attr.delete('xmlns')
|
40
|
+
attr.delete('display')
|
41
|
+
result.insert("<math".length, converter.html_attributes(attr))
|
42
|
+
|
43
|
+
(type == :block ? "#{' '*opts[:indent]}#{result}\n" : result)
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
@@ -27,7 +27,7 @@ module Kramdown::Converter::SyntaxHighlighter
|
|
27
27
|
if type == :span && lang
|
28
28
|
::CodeRay.scan(text, lang.to_sym).html(options(converter, :span)).chomp
|
29
29
|
elsif type == :block && (lang || options(converter, :default_lang))
|
30
|
-
lang = (lang || options(converter, :default_lang)).to_sym
|
30
|
+
lang = (lang || options(converter, :default_lang)).to_s.gsub(/-/, '_').to_sym
|
31
31
|
::CodeRay.scan(text, lang).html(options(converter, :block)).chomp << "\n"
|
32
32
|
else
|
33
33
|
nil
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
#
|
3
|
+
#--
|
4
|
+
# Copyright (C) 2009-2015 Thomas Leitner <t_leitner@gmx.at>
|
5
|
+
#
|
6
|
+
# This file is part of kramdown which is licensed under the MIT.
|
7
|
+
#++
|
8
|
+
#
|
9
|
+
|
10
|
+
module Kramdown::Converter::SyntaxHighlighter
|
11
|
+
|
12
|
+
# Uses Minted to highlight code blocks and code spans.
|
13
|
+
module Minted
|
14
|
+
|
15
|
+
def self.call(converter, text, lang, type, _opts)
|
16
|
+
opts = converter.options[:syntax_highlighter_opts]
|
17
|
+
|
18
|
+
# Fallback to default language
|
19
|
+
lang ||= opts[:default_lang]
|
20
|
+
|
21
|
+
options = []
|
22
|
+
options << "breaklines" if opts[:wrap]
|
23
|
+
options << "linenos" if opts[:line_numbers]
|
24
|
+
options << "frame=#{opts[:frame]}" if opts[:frame]
|
25
|
+
|
26
|
+
if lang && type == :block
|
27
|
+
"\\begin{minted}[#{options.join(',')}]{#{lang}}\n#{text}\n\\end{minted}"
|
28
|
+
elsif lang && type == :span
|
29
|
+
"\\mintinline{#{lang}}{#{text}}"
|
30
|
+
else
|
31
|
+
nil
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/lib/kramdown/options.rb
CHANGED
@@ -525,7 +525,7 @@ Options for the syntax highlighter can be set with the
|
|
525
525
|
syntax_highlighter_opts configuration option.
|
526
526
|
|
527
527
|
Default: coderay
|
528
|
-
Used by: HTML converter
|
528
|
+
Used by: HTML/Latex converter
|
529
529
|
EOF
|
530
530
|
|
531
531
|
define(:syntax_highlighter_opts, Object, {}, <<EOF) do |val|
|
@@ -538,7 +538,7 @@ The value needs to be a hash with key-value pairs that are understood by
|
|
538
538
|
the used syntax highlighter.
|
539
539
|
|
540
540
|
Default: {}
|
541
|
-
Used by: HTML converter
|
541
|
+
Used by: HTML/Latex converter
|
542
542
|
EOF
|
543
543
|
val = simple_hash_validator(val, :syntax_highlighter_opts)
|
544
544
|
val.keys.each do |k|
|
data/lib/kramdown/parser/gfm.rb
CHANGED
@@ -55,7 +55,7 @@ module Kramdown
|
|
55
55
|
ATX_HEADER_START = /^\#{1,6}\s/
|
56
56
|
define_parser(:atx_header_gfm, ATX_HEADER_START, nil, 'parse_atx_header')
|
57
57
|
|
58
|
-
FENCED_CODEBLOCK_MATCH = /^(([~`]){3,})\s*?(\w
|
58
|
+
FENCED_CODEBLOCK_MATCH = /^(([~`]){3,})\s*?(\w[\w-]*)?\s*?\n(.*?)^\1\2*\s*?\n/m
|
59
59
|
define_parser(:codeblock_fenced_gfm, /^[~`]{3,}/, nil, 'parse_codeblock_fenced')
|
60
60
|
|
61
61
|
end
|
data/lib/kramdown/parser/html.rb
CHANGED
@@ -150,7 +150,7 @@ module Kramdown
|
|
150
150
|
elsif result = @src.scan(HTML_INSTRUCTION_RE)
|
151
151
|
@tree.children << Element.new(:xml_pi, result, nil, :category => :block, :location => line)
|
152
152
|
elsif @src.scan(HTML_TAG_RE)
|
153
|
-
if method(:handle_html_start_tag).arity
|
153
|
+
if method(:handle_html_start_tag).arity.abs >= 1
|
154
154
|
handle_html_start_tag(line, &block)
|
155
155
|
else
|
156
156
|
handle_html_start_tag(&block) # DEPRECATED: method needs to accept line number in 2.0
|
@@ -422,7 +422,7 @@ module Kramdown
|
|
422
422
|
else
|
423
423
|
set_basics(el, :codeblock)
|
424
424
|
if el.children.size == 1 && el.children.first.value == 'code'
|
425
|
-
value = (el.children.first.attr['class'] || '').scan(/\blanguage-\w
|
425
|
+
value = (el.children.first.attr['class'] || '').scan(/\blanguage-\w[\w-]*\b/).first
|
426
426
|
el.attr['class'] = "#{value} #{el.attr['class']}".rstrip if value
|
427
427
|
end
|
428
428
|
end
|
@@ -32,7 +32,7 @@ module Kramdown
|
|
32
32
|
|
33
33
|
|
34
34
|
FENCED_CODEBLOCK_START = /^~{3,}/
|
35
|
-
FENCED_CODEBLOCK_MATCH = /^((~){3,})\s*?(\w
|
35
|
+
FENCED_CODEBLOCK_MATCH = /^((~){3,})\s*?(\w[\w-]*)?\s*?\n(.*?)^\1\2*\s*?\n/m
|
36
36
|
|
37
37
|
# Parse the fenced codeblock at the current location.
|
38
38
|
def parse_codeblock_fenced
|
@@ -18,10 +18,11 @@ module Kramdown
|
|
18
18
|
id.gsub(/[\s]+/, ' ').downcase
|
19
19
|
end
|
20
20
|
|
21
|
-
LINK_DEFINITION_START = /^#{OPT_SPACE}\[([^\n\]]+)\]:[ \t]*(?:<(.*?)>|([
|
21
|
+
LINK_DEFINITION_START = /^#{OPT_SPACE}\[([^\n\]]+)\]:[ \t]*(?:<(.*?)>|([^\n]*?\S[^\n]*?))(?:(?:[ \t]*?\n|[ \t]+?)[ \t]*?(["'])(.+?)\4)?[ \t]*?\n/
|
22
22
|
|
23
23
|
# Parse the link definition at the current location.
|
24
24
|
def parse_link_definition
|
25
|
+
return false if @src[3].to_s =~ /[ \t]+["']/
|
25
26
|
@src.pos += @src.matched_size
|
26
27
|
link_id, link_url, link_title = normalize_link_id(@src[1]), @src[2] || @src[3], @src[5]
|
27
28
|
warning("Duplicate link ID '#{link_id}' on line #{@src.current_line_number} - overwriting") if @link_defs[link_id]
|
@@ -29,7 +29,7 @@ module Kramdown
|
|
29
29
|
singleton_class = (class << self; self; end)
|
30
30
|
singleton_class.send(:define_method, :configurables) do
|
31
31
|
@_configurables ||= Hash.new {|h, k| h[k] = {}}
|
32
|
-
end
|
32
|
+
end unless respond_to?(:configurables)
|
33
33
|
singleton_class.send(:define_method, name) do |data|
|
34
34
|
configurables[name][data]
|
35
35
|
end
|
data/lib/kramdown/version.rb
CHANGED
data/man/man1/kramdown.1
CHANGED
@@ -35,41 +35,16 @@ Show the help.
|
|
35
35
|
.SH KRAMDOWN OPTIONS
|
36
36
|
|
37
37
|
.TP
|
38
|
-
.B \-\-
|
39
|
-
|
40
|
-
The name of an ERB template file that should be used to wrap the output
|
41
|
-
or the ERB template itself.
|
42
|
-
|
43
|
-
This is used to wrap the output in an environment so that the output can
|
44
|
-
be used as a stand-alone document. For example, an HTML template would
|
45
|
-
provide the needed header and body tags so that the whole output is a
|
46
|
-
valid HTML file. If no template is specified, the output will be just
|
47
|
-
the converted text.
|
38
|
+
.B \-\-auto-id-prefix ARG
|
48
39
|
|
49
|
-
|
50
|
-
If such a file is not found, the converter extension (the same as the
|
51
|
-
converter name) is appended. If the file still cannot be found, the
|
52
|
-
templates name is interpreted as a template name that is provided by
|
53
|
-
kramdown (without the converter extension). If the file is still not
|
54
|
-
found, the template name is checked if it starts with 'string://' and if
|
55
|
-
it does, this prefix is removed and the rest is used as template
|
56
|
-
content.
|
40
|
+
Prefix used for automatically generated header IDs
|
57
41
|
|
58
|
-
|
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!
|
59
46
|
|
60
47
|
Default: ''
|
61
|
-
Used by: all converters
|
62
|
-
|
63
|
-
|
64
|
-
.TP
|
65
|
-
.B \-\-[no\-]auto-ids
|
66
|
-
|
67
|
-
Use automatic header ID generation
|
68
|
-
|
69
|
-
If this option is `true`, ID values for all headers are automatically
|
70
|
-
generated if no ID is explicitly specified.
|
71
|
-
|
72
|
-
Default: true
|
73
48
|
Used by: HTML/Latex converter
|
74
49
|
|
75
50
|
|
@@ -90,103 +65,92 @@ Used by: kramdown parser
|
|
90
65
|
|
91
66
|
|
92
67
|
.TP
|
93
|
-
.B \-\-auto-
|
68
|
+
.B \-\-[no\-]auto-ids
|
94
69
|
|
95
|
-
|
70
|
+
Use automatic header ID generation
|
96
71
|
|
97
|
-
|
98
|
-
|
99
|
-
documents into one output file separately. The prefix should only
|
100
|
-
contain characters that are valid in an ID!
|
72
|
+
If this option is `true`, ID values for all headers are automatically
|
73
|
+
generated if no ID is explicitly specified.
|
101
74
|
|
102
|
-
Default:
|
75
|
+
Default: true
|
103
76
|
Used by: HTML/Latex converter
|
104
77
|
|
105
78
|
|
106
79
|
.TP
|
107
|
-
.B \-\-
|
108
|
-
|
109
|
-
Transliterate the header text before generating the ID
|
80
|
+
.B \-\-coderay-bold-every ARG
|
110
81
|
|
111
|
-
|
112
|
-
languages with many non-ASCII characters. By enabling this option
|
113
|
-
the header text is transliterated to ASCII as good as possible so that
|
114
|
-
the resulting header ID is more useful.
|
82
|
+
Defines how often a line number should be made bold
|
115
83
|
|
116
|
-
|
84
|
+
Can either be an integer or false (to turn off bold line numbers
|
85
|
+
completely).
|
117
86
|
|
118
|
-
Default:
|
119
|
-
Used by: HTML
|
87
|
+
Default: 10
|
88
|
+
Used by: HTML converter
|
120
89
|
|
121
90
|
|
122
91
|
.TP
|
123
|
-
.B \-\-
|
92
|
+
.B \-\-coderay-css ARG
|
124
93
|
|
125
|
-
|
94
|
+
Defines how the highlighted code gets styled
|
126
95
|
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
selectively enable kramdown processing via the markdown attribute.
|
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).
|
131
99
|
|
132
|
-
Default:
|
133
|
-
Used by:
|
100
|
+
Default: style
|
101
|
+
Used by: HTML converter
|
134
102
|
|
135
103
|
|
136
104
|
.TP
|
137
|
-
.B \-\-
|
105
|
+
.B \-\-coderay-default-lang ARG
|
138
106
|
|
139
|
-
|
107
|
+
Sets the default language for highlighting code blocks
|
140
108
|
|
141
|
-
If
|
142
|
-
|
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.
|
143
112
|
|
144
|
-
Default:
|
145
|
-
Used by:
|
113
|
+
Default: nil
|
114
|
+
Used by: HTML converter
|
146
115
|
|
147
116
|
|
148
117
|
.TP
|
149
|
-
.B \-\-
|
118
|
+
.B \-\-coderay-line-number-start ARG
|
150
119
|
|
151
|
-
|
120
|
+
The start value for the line numbers
|
152
121
|
|
153
|
-
|
154
|
-
|
155
|
-
would normally be converted to an `:html` element with tag type `:em`.
|
156
|
-
If `html_to_native` is `true`, then the emphasis would be converted to a
|
157
|
-
native `:em` element.
|
122
|
+
Default: 1
|
123
|
+
Used by: HTML converter
|
158
124
|
|
159
|
-
This is useful for converters that cannot deal with HTML elements.
|
160
125
|
|
161
|
-
|
162
|
-
|
126
|
+
.TP
|
127
|
+
.B \-\-coderay-line-numbers ARG
|
163
128
|
|
129
|
+
Defines how and if line numbers should be shown
|
164
130
|
|
165
|
-
.
|
166
|
-
|
131
|
+
The possible values are :table, :inline or nil. If this option is
|
132
|
+
nil, no line numbers are shown.
|
167
133
|
|
168
|
-
|
134
|
+
Default: :inline
|
135
|
+
Used by: HTML converter
|
169
136
|
|
170
|
-
This option can be used to pre-define link definitions. The value needs
|
171
|
-
to be a Hash where the keys are the link identifiers and the values are
|
172
|
-
two element Arrays with the link URL and the link title.
|
173
137
|
|
174
|
-
|
175
|
-
|
138
|
+
.TP
|
139
|
+
.B \-\-coderay-tab-width ARG
|
176
140
|
|
177
|
-
|
178
|
-
|
141
|
+
The tab width used in highlighted code
|
142
|
+
|
143
|
+
Used by: HTML converter
|
179
144
|
|
180
145
|
|
181
146
|
.TP
|
182
|
-
.B \-\-
|
147
|
+
.B \-\-coderay-wrap ARG
|
183
148
|
|
184
|
-
|
149
|
+
Defines how the highlighted code should be wrapped
|
185
150
|
|
186
|
-
|
187
|
-
footnote.
|
151
|
+
The possible values are :span, :div or nil.
|
188
152
|
|
189
|
-
Default:
|
153
|
+
Default: :div
|
190
154
|
Used by: HTML converter
|
191
155
|
|
192
156
|
|
@@ -203,144 +167,166 @@ Used by: HTML converter
|
|
203
167
|
|
204
168
|
|
205
169
|
.TP
|
206
|
-
.B \-\-
|
170
|
+
.B \-\-entity-output ARG
|
207
171
|
|
208
|
-
Defines how
|
172
|
+
Defines how entities are output
|
209
173
|
|
210
|
-
The possible values are :
|
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).
|
211
179
|
|
212
|
-
Default: :
|
213
|
-
Used by: HTML converter
|
180
|
+
Default: :as_char
|
181
|
+
Used by: HTML converter, kramdown converter
|
214
182
|
|
215
183
|
|
216
184
|
.TP
|
217
|
-
.B \-\-
|
185
|
+
.B \-\-footnote-nr ARG
|
218
186
|
|
219
|
-
|
187
|
+
The number of the first footnote
|
220
188
|
|
221
|
-
|
222
|
-
|
189
|
+
This option can be used to specify the number that is used for the first
|
190
|
+
footnote.
|
223
191
|
|
224
|
-
Default:
|
192
|
+
Default: 1
|
225
193
|
Used by: HTML converter
|
226
194
|
|
227
195
|
|
228
196
|
.TP
|
229
|
-
.B \-\-
|
197
|
+
.B \-\-[no\-]hard-wrap
|
230
198
|
|
231
|
-
|
199
|
+
Interprets line breaks literally
|
232
200
|
|
233
|
-
|
234
|
-
|
201
|
+
Insert HTML `<br />` tags inside paragraphs where the original Markdown
|
202
|
+
document had newlines (by default, Markdown ignores these newlines).
|
203
|
+
|
204
|
+
Default: true
|
205
|
+
Used by: GFM parser
|
235
206
|
|
236
207
|
|
237
208
|
.TP
|
238
|
-
.B \-\-
|
209
|
+
.B \-\-header-offset ARG
|
239
210
|
|
240
|
-
|
211
|
+
Sets the output offset for headers
|
241
212
|
|
242
|
-
|
213
|
+
If this option is c (may also be negative) then a header with level n
|
214
|
+
will be output as a header with level c+n. If c+n is lower than 1,
|
215
|
+
level 1 will be used. If c+n is greater than 6, level 6 will be used.
|
216
|
+
|
217
|
+
Default: 0
|
218
|
+
Used by: HTML converter, Kramdown converter, Latex converter
|
243
219
|
|
244
220
|
|
245
221
|
.TP
|
246
|
-
.B \-\-
|
222
|
+
.B \-\-[no\-]html-to-native
|
247
223
|
|
248
|
-
|
224
|
+
Convert HTML elements to native elements
|
249
225
|
|
250
|
-
|
251
|
-
|
226
|
+
If this option is `true`, the parser converts HTML elements to native
|
227
|
+
elements. For example, when parsing `<em>hallo</em>` the emphasis tag
|
228
|
+
would normally be converted to an `:html` element with tag type `:em`.
|
229
|
+
If `html_to_native` is `true`, then the emphasis would be converted to a
|
230
|
+
native `:em` element.
|
252
231
|
|
253
|
-
|
254
|
-
|
232
|
+
This is useful for converters that cannot deal with HTML elements.
|
233
|
+
|
234
|
+
Default: false
|
235
|
+
Used by: kramdown parser
|
255
236
|
|
256
237
|
|
257
238
|
.TP
|
258
|
-
.B \-\-
|
239
|
+
.B \-\-latex-headers ARG
|
259
240
|
|
260
|
-
Defines
|
241
|
+
Defines the LaTeX commands for different header levels
|
261
242
|
|
262
|
-
|
263
|
-
|
264
|
-
styles are directly applied to the code elements).
|
243
|
+
The commands for the header levels one to six can be specified by
|
244
|
+
separating them with commas.
|
265
245
|
|
266
|
-
Default:
|
267
|
-
Used by:
|
246
|
+
Default: section,subsection,subsubsection,paragraph,subparagraph,subparagraph
|
247
|
+
Used by: Latex converter
|
268
248
|
|
269
249
|
|
270
250
|
.TP
|
271
|
-
.B \-\-
|
272
|
-
|
273
|
-
Sets the default language for highlighting code blocks
|
251
|
+
.B \-\-line-width ARG
|
274
252
|
|
275
|
-
|
276
|
-
instead. The value has to be one of the languages supported by coderay
|
277
|
-
or nil if no default language should be used.
|
253
|
+
Defines the line width to be used when outputting a document
|
278
254
|
|
279
|
-
Default:
|
280
|
-
Used by:
|
255
|
+
Default: 72
|
256
|
+
Used by: kramdown converter
|
281
257
|
|
282
258
|
|
283
259
|
.TP
|
284
|
-
.B \-\-
|
260
|
+
.B \-\-link-defs ARG
|
285
261
|
|
286
|
-
|
262
|
+
Pre-defines link definitions
|
287
263
|
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
:as_char (entities are output as characters if possible, only available
|
292
|
-
on Ruby 1.9).
|
264
|
+
This option can be used to pre-define link definitions. The value needs
|
265
|
+
to be a Hash where the keys are the link identifiers and the values are
|
266
|
+
two element Arrays with the link URL and the link title.
|
293
267
|
|
294
|
-
|
295
|
-
|
268
|
+
If the value is a String, it has to contain a valid YAML hash and the
|
269
|
+
hash has to follow the above guidelines.
|
270
|
+
|
271
|
+
Default: {}
|
272
|
+
Used by: kramdown parser
|
296
273
|
|
297
274
|
|
298
275
|
.TP
|
299
|
-
.B \-\-
|
276
|
+
.B \-\-math-engine ARG
|
300
277
|
|
301
|
-
|
278
|
+
Set the math engine
|
302
279
|
|
303
|
-
|
304
|
-
|
305
|
-
|
280
|
+
Specifies the math engine that should be used for converting math
|
281
|
+
blocks/spans. If this option is set to +nil+, no math engine is used and
|
282
|
+
the math blocks/spans are output as is.
|
306
283
|
|
307
|
-
|
308
|
-
|
284
|
+
Options for the selected math engine can be set with the
|
285
|
+
math_engine_opts configuration option.
|
286
|
+
|
287
|
+
Default: mathjax
|
288
|
+
Used by: HTML converter
|
309
289
|
|
310
290
|
|
311
291
|
.TP
|
312
|
-
.B \-\-
|
292
|
+
.B \-\-math-engine-opts ARG
|
313
293
|
|
314
|
-
|
294
|
+
Set the math engine options
|
315
295
|
|
316
|
-
|
317
|
-
|
296
|
+
Specifies options for the math engine set via the math_engine
|
297
|
+
configuration option.
|
298
|
+
|
299
|
+
The value needs to be a hash with key-value pairs that are understood by
|
300
|
+
the used math engine.
|
301
|
+
|
302
|
+
Default: {}
|
303
|
+
Used by: HTML converter
|
318
304
|
|
319
305
|
|
320
306
|
.TP
|
321
|
-
.B \-\-
|
307
|
+
.B \-\-[no\-]parse-block-html
|
322
308
|
|
323
|
-
|
309
|
+
Process kramdown syntax in block HTML tags
|
324
310
|
|
325
|
-
|
326
|
-
|
311
|
+
If this option is `true`, the kramdown parser processes the content of
|
312
|
+
block HTML tags as text containing block-level elements. Since this is
|
313
|
+
not wanted normally, the default is `false`. It is normally better to
|
314
|
+
selectively enable kramdown processing via the markdown attribute.
|
327
315
|
|
328
|
-
Default:
|
329
|
-
Used by:
|
316
|
+
Default: false
|
317
|
+
Used by: kramdown parser
|
330
318
|
|
331
319
|
|
332
320
|
.TP
|
333
|
-
.B \-\-
|
321
|
+
.B \-\-[no\-]parse-span-html
|
334
322
|
|
335
|
-
|
323
|
+
Process kramdown syntax in span HTML tags
|
336
324
|
|
337
|
-
|
338
|
-
|
339
|
-
double and a right double quote are specified by separating them with
|
340
|
-
commas.
|
325
|
+
If this option is `true`, the kramdown parser processes the content of
|
326
|
+
span HTML tags as text containing span-level elements.
|
341
327
|
|
342
|
-
Default:
|
343
|
-
Used by:
|
328
|
+
Default: true
|
329
|
+
Used by: kramdown parser
|
344
330
|
|
345
331
|
|
346
332
|
.TP
|
@@ -368,28 +354,17 @@ Used by: RemoveHtmlTags converter
|
|
368
354
|
|
369
355
|
|
370
356
|
.TP
|
371
|
-
.B \-\-
|
372
|
-
|
373
|
-
Sets the output offset for headers
|
374
|
-
|
375
|
-
If this option is c (may also be negative) then a header with level n
|
376
|
-
will be output as a header with level c+n. If c+n is lower than 1,
|
377
|
-
level 1 will be used. If c+n is greater than 6, level 6 will be used.
|
378
|
-
|
379
|
-
Default: 0
|
380
|
-
Used by: HTML converter, Kramdown converter, Latex converter
|
381
|
-
|
382
|
-
|
383
|
-
.TP
|
384
|
-
.B \-\-[no\-]hard-wrap
|
357
|
+
.B \-\-smart-quotes ARG
|
385
358
|
|
386
|
-
|
359
|
+
Defines the HTML entity names or code points for smart quote output
|
387
360
|
|
388
|
-
|
389
|
-
|
361
|
+
The entities identified by entity name or code point that should be
|
362
|
+
used for, in order, a left single quote, a right single quote, a left
|
363
|
+
double and a right double quote are specified by separating them with
|
364
|
+
commas.
|
390
365
|
|
391
|
-
Default:
|
392
|
-
Used by:
|
366
|
+
Default: lsquo,rsquo,ldquo,rdquo
|
367
|
+
Used by: HTML/Latex converter
|
393
368
|
|
394
369
|
|
395
370
|
.TP
|
@@ -405,7 +380,7 @@ Options for the syntax highlighter can be set with the
|
|
405
380
|
syntax_highlighter_opts configuration option.
|
406
381
|
|
407
382
|
Default: coderay
|
408
|
-
Used by: HTML converter
|
383
|
+
Used by: HTML/Latex converter
|
409
384
|
|
410
385
|
|
411
386
|
.TP
|
@@ -420,38 +395,63 @@ The value needs to be a hash with key-value pairs that are understood by
|
|
420
395
|
the used syntax highlighter.
|
421
396
|
|
422
397
|
Default: {}
|
423
|
-
Used by: HTML converter
|
398
|
+
Used by: HTML/Latex converter
|
424
399
|
|
425
400
|
|
426
401
|
.TP
|
427
|
-
.B \-\-
|
402
|
+
.B \-\-template ARG
|
428
403
|
|
429
|
-
|
404
|
+
The name of an ERB template file that should be used to wrap the output
|
405
|
+
or the ERB template itself.
|
430
406
|
|
431
|
-
|
432
|
-
|
433
|
-
the
|
407
|
+
This is used to wrap the output in an environment so that the output can
|
408
|
+
be used as a stand-alone document. For example, an HTML template would
|
409
|
+
provide the needed header and body tags so that the whole output is a
|
410
|
+
valid HTML file. If no template is specified, the output will be just
|
411
|
+
the converted text.
|
434
412
|
|
435
|
-
|
436
|
-
|
413
|
+
When resolving the template file, the given template name is used first.
|
414
|
+
If such a file is not found, the converter extension (the same as the
|
415
|
+
converter name) is appended. If the file still cannot be found, the
|
416
|
+
templates name is interpreted as a template name that is provided by
|
417
|
+
kramdown (without the converter extension). If the file is still not
|
418
|
+
found, the template name is checked if it starts with 'string://' and if
|
419
|
+
it does, this prefix is removed and the rest is used as template
|
420
|
+
content.
|
437
421
|
|
438
|
-
|
439
|
-
|
422
|
+
kramdown provides a default template named 'document' for each converter.
|
423
|
+
|
424
|
+
Default: ''
|
425
|
+
Used by: all converters
|
440
426
|
|
441
427
|
|
442
428
|
.TP
|
443
|
-
.B \-\-
|
429
|
+
.B \-\-toc-levels ARG
|
444
430
|
|
445
|
-
|
431
|
+
Defines the levels that are used for the table of contents
|
446
432
|
|
447
|
-
|
448
|
-
|
433
|
+
The individual levels can be specified by separating them with commas
|
434
|
+
(e.g. 1,2,3) or by using the range syntax (e.g. 1..3). Only the
|
435
|
+
specified levels are used for the table of contents.
|
449
436
|
|
450
|
-
|
451
|
-
|
437
|
+
Default: 1..6
|
438
|
+
Used by: HTML/Latex converter
|
452
439
|
|
453
|
-
|
454
|
-
|
440
|
+
|
441
|
+
.TP
|
442
|
+
.B \-\-[no\-]transliterated-header-ids
|
443
|
+
|
444
|
+
Transliterate the header text before generating the ID
|
445
|
+
|
446
|
+
Only ASCII characters are used in headers IDs. This is not good for
|
447
|
+
languages with many non-ASCII characters. By enabling this option
|
448
|
+
the header text is transliterated to ASCII as good as possible so that
|
449
|
+
the resulting header ID is more useful.
|
450
|
+
|
451
|
+
The stringex library needs to be installed for this feature to work!
|
452
|
+
|
453
|
+
Default: false
|
454
|
+
Used by: HTML/Latex converter
|
455
455
|
|
456
456
|
|
457
457
|
.SH EXIT STATUS
|