kitabu 3.0.0 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +24 -0
- data/lib/kitabu/markdown.rb +23 -13
- data/lib/kitabu/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e126b39636b3d6a78fb02e979c631f3f4e4694e8122e5009c09ed272bb81ceb4
|
4
|
+
data.tar.gz: 1d09aa18b28b24e7f6edbb96a1d3c689a8548ba58608737f92a354deb79a9c8c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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>
|
data/lib/kitabu/markdown.rb
CHANGED
@@ -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
|
-
|
16
|
-
|
17
|
-
self.
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
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)
|
data/lib/kitabu/version.rb
CHANGED