lib/kramdown/options.rb in kramdown-1.2.0 vs lib/kramdown/options.rb in kramdown-1.3.0
- old
+ new
@@ -77,12 +77,11 @@
# names are considered and their value is run through the #parse method.
def self.merge(hash)
temp = defaults
hash.each do |k,v|
k = k.to_sym
- next unless @options.has_key?(k)
- temp[k] = parse(k, v)
+ @options.has_key?(k) ? temp[k] = parse(k, v) : temp[k] = v
end
temp
end
# Parse the given value +data+ as if it was a value for the option +name+ and return the parsed
@@ -145,22 +144,26 @@
# parsers/converters.
# ----------------------------
define(:template, String, '', <<EOF)
The name of an ERB template file that should be used to wrap the output
+or the ERB template itself.
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.
When resolving the template file, the given template name is used first.
-If such a file is not found, the converter extension 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 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 'string://' and if
+it does, this prefix is removed and the rest is used as template
+content.
kramdown provides a default template named 'document' for each converter.
Default: ''
Used by: all converters
@@ -174,12 +177,26 @@
Default: true
Used by: HTML/Latex converter
EOF
+ define(:auto_id_stripping, Boolean, false, <<EOF)
+Strip all formatting from header text for automatic ID generation
+
+If this option is `true`, only the text elements of a header are used
+for generating the ID later (in contrast to just using the raw header
+text line).
+
+This option will be removed in version 2.0 because this will be the
+default then.
+
+Default: false
+Used by: kramdown parser
+EOF
+
define(:auto_id_prefix, String, '', <<EOF)
-Prefix used for automatically generated heaer IDs
+Prefix used for automatically generated header IDs
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!
@@ -319,16 +336,25 @@
The tab width used in highlighted code
Used by: HTML converter
EOF
- define(:coderay_bold_every, Integer, 10, <<EOF)
+ define(:coderay_bold_every, Object, 10, <<EOF) do |val|
Defines how often a line number should be made bold
+Can either be an integer or false (to turn off bold line numbers
+completely).
+
Default: 10
Used by: HTML converter
EOF
+ if val == false || val.to_s == 'false'
+ false
+ else
+ Integer(val.to_s) rescue raise Kramdown::Error, "Invalid value for option 'coderay_bold_every'"
+ end
+end
define(:coderay_css, Symbol, :style, <<EOF)
Defines how the highlighted code gets styled
Possible values are :class (CSS classes are applied to the code
@@ -454,9 +480,19 @@
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.
Default: 0
Used by: HTML converter, Kramdown converter, Latex converter
+EOF
+
+ define(:hard_wrap, Boolean, true, <<EOF)
+Interprets line breaks literally
+
+Insert HTML `<br />` tags inside paragraphs where the original Markdown
+document had newlines (by default, Markdown ignores these newlines).
+
+Default: true
+Used by: GFM parser
EOF
end
end