kitabu 3.0.0 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 67dfc339caf3fcde8f9c111801b31da92436357351b9b2c1c20b7bd8c245924d
4
- data.tar.gz: 72ecccbb8355246adfe7411897bfaa36688e7340ca086a04770c335ec85939a4
3
+ metadata.gz: e126b39636b3d6a78fb02e979c631f3f4e4694e8122e5009c09ed272bb81ceb4
4
+ data.tar.gz: 1d09aa18b28b24e7f6edbb96a1d3c689a8548ba58608737f92a354deb79a9c8c
5
5
  SHA512:
6
- metadata.gz: 44b5cc67bc89e983b295f74e5cb26c70ee0ceb3f450b9be3fa4cf28d6287ae1f7254d83926114f6262d6c55c8dd74922fc4d47e7a40aa15f3c94af18cf6e5629
7
- data.tar.gz: 3aca9c59341c104e8de6cec75cc3f9aeaef012c83529a3acb3dee9366df15e9962d154a030bd16785906ddf758dd653140525c8230c25480cd7d76432190c065
6
+ metadata.gz: 997c2d38c02eab984c598a6d7af5ba55f921fada0073ecc46e118548b58ea718ecd10d613689aaa100a7eaec74549f260495e160ed6fd862d73abb18e57d7926
7
+ data.tar.gz: 89a810a3e676097b92f320fc9e821bcfc15e098c19824da0d03ebd71ef2d6388fa68ee67497329921bdcc6020450ecab301651f99c32062cd691716ecd86ed28
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## v3.0.1
4
+
5
+ - Add accessor methods `Kitabu::Markdown.default_renderer_options` and
6
+ `Kitabu::Markdown.default_markdown_options`.
7
+ - Set Redcarpet's `hard_wrap` to `false`.
8
+
3
9
  ## v3.0.0
4
10
 
5
11
  - Drop Sass support; the `styles` directory will now be copied to the `output`
data/README.md CHANGED
@@ -229,6 +229,30 @@ Finally, to use this font, do something like this:
229
229
  }
230
230
  ```
231
231
 
232
+ ### Configuring Markdown
233
+
234
+ Kitabu uses [Redcarpet](https://github.com/vmg/redcarpet) as the Markdown
235
+ engine. You can override the default processor by setting
236
+ `Kitabu::Markdown.processor`. This can be done by adding something like the
237
+ following to `config/helper.rb`:
238
+
239
+ ```ruby
240
+ Kitabu::Markdown.processor = Redcarpet::Markdown.new(
241
+ Kitabu::Markdown::Renderer.new(hard_wrap: false, safe_links_only: true),
242
+ tables: true,
243
+ footnotes: true,
244
+ space_after_headers: true,
245
+ superscript: true,
246
+ highlight: true,
247
+ strikethrough: true,
248
+ autolink: true,
249
+ fenced_code_blocks: true,
250
+ no_intra_emphasis: true
251
+ )
252
+ ```
253
+
254
+ The above options are Kitabu's defaults.
255
+
232
256
  ## References
233
257
 
234
258
  - Markdown: <http://daringfireball.net/projects/markdown/syntax>
@@ -10,21 +10,31 @@ module Kitabu
10
10
  class << self
11
11
  # Set markdown renderer
12
12
  attr_accessor :processor
13
+
14
+ # Set the default markdown renderer's options.
15
+ attr_accessor :default_renderer_options
16
+
17
+ # Set the default markdown options.
18
+ attr_accessor :default_markdown_options
13
19
  end
14
20
 
15
- renderer = Renderer.new(hard_wrap: true, safe_links_only: true)
16
-
17
- self.processor = Redcarpet::Markdown.new(renderer, {
18
- tables: true,
19
- footnotes: true,
20
- space_after_headers: true,
21
- superscript: true,
22
- highlight: true,
23
- strikethrough: true,
24
- autolink: true,
25
- fenced_code_blocks: true,
26
- no_intra_emphasis: true
27
- })
21
+ self.default_renderer_options = {hard_wrap: false, safe_links_only: true}
22
+
23
+ self.default_markdown_options = {
24
+ tables: true,
25
+ footnotes: true,
26
+ space_after_headers: true,
27
+ superscript: true,
28
+ highlight: true,
29
+ strikethrough: true,
30
+ autolink: true,
31
+ fenced_code_blocks: true,
32
+ no_intra_emphasis: true
33
+ }
34
+
35
+ renderer = Renderer.new(default_renderer_options)
36
+
37
+ self.processor = Redcarpet::Markdown.new(renderer, default_markdown_options)
28
38
 
29
39
  def self.render(text)
30
40
  processor.render(text)
@@ -4,7 +4,7 @@ module Kitabu
4
4
  module Version
5
5
  MAJOR = 3
6
6
  MINOR = 0
7
- PATCH = 0
7
+ PATCH = 1
8
8
  STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitabu
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nando Vieira