markdown-rails 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.md +7 -0
- data/README.md +2 -2
- data/lib/markdown-rails.rb +2 -1
- data/lib/markdown-rails/engine.rb +37 -0
- data/lib/markdown-rails/version.rb +3 -0
- data/markdown-rails.gemspec +2 -2
- metadata +9 -8
- data/lib/markdown/rails/engine.rb +0 -38
- data/lib/markdown/rails/version.rb +0 -5
data/History.md
ADDED
data/README.md
CHANGED
@@ -56,7 +56,7 @@ By default markdown-rails uses the
|
|
56
56
|
by calling `config.render` like so:
|
57
57
|
|
58
58
|
```ruby
|
59
|
-
|
59
|
+
MarkdownRails.configure do |config|
|
60
60
|
config.render do |markdown_source|
|
61
61
|
# Return compiled HTML here ...
|
62
62
|
end
|
@@ -71,7 +71,7 @@ parser options. To do so, add the `redcarpet` gem to your Gemfile, and add the
|
|
71
71
|
following into a `config/initializers/markdown.rb` file:
|
72
72
|
|
73
73
|
```ruby
|
74
|
-
|
74
|
+
MarkdownRails.configure do |config|
|
75
75
|
markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML,
|
76
76
|
:fenced_code_blocks => true,
|
77
77
|
:autolink => true,
|
data/lib/markdown-rails.rb
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
require 'markdown
|
1
|
+
require 'markdown-rails/version'
|
2
|
+
require 'markdown-rails/engine'
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'rdiscount'
|
2
|
+
require 'action_view'
|
3
|
+
|
4
|
+
# We cannot use Markdown::Rails because it conflicts with RDiscount's Markdown class
|
5
|
+
module MarkdownRails
|
6
|
+
class Handler
|
7
|
+
def initialize
|
8
|
+
end
|
9
|
+
|
10
|
+
def call(template)
|
11
|
+
# Return Ruby code that returns the compiled template
|
12
|
+
MarkdownRails.renderer.call(template.source).inspect + '.html_safe'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
class <<self
|
17
|
+
def configure
|
18
|
+
yield self
|
19
|
+
end
|
20
|
+
|
21
|
+
attr_accessor :renderer
|
22
|
+
|
23
|
+
def render(&block)
|
24
|
+
self.renderer = block
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
MarkdownRails.configure do |config|
|
30
|
+
config.render do |markdown_source|
|
31
|
+
RDiscount.new(markdown_source).to_html
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
handler = MarkdownRails::Handler.new
|
36
|
+
ActionView::Template.register_template_handler(:md, handler)
|
37
|
+
ActionView::Template.register_template_handler(:markdown, handler)
|
data/markdown-rails.gemspec
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
require File.expand_path('../lib/markdown
|
2
|
+
require File.expand_path('../lib/markdown-rails/version', __FILE__)
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "markdown-rails"
|
6
|
-
s.version =
|
6
|
+
s.version = MarkdownRails::VERSION
|
7
7
|
s.authors = ["Jo Liss"]
|
8
8
|
s.email = ["joliss42@gmail.com"]
|
9
9
|
s.homepage = "https://github.com/joliss/markdown-rails"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: markdown-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-02-
|
12
|
+
date: 2012-02-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
|
-
requirement: &
|
16
|
+
requirement: &16496040 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 3.0.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *16496040
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rdiscount
|
27
|
-
requirement: &
|
27
|
+
requirement: &16495540 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -35,7 +35,7 @@ dependencies:
|
|
35
35
|
version: '2.0'
|
36
36
|
type: :runtime
|
37
37
|
prerelease: false
|
38
|
-
version_requirements: *
|
38
|
+
version_requirements: *16495540
|
39
39
|
description: Markdown as a static templating language for Rails views and partials
|
40
40
|
email:
|
41
41
|
- joliss42@gmail.com
|
@@ -45,11 +45,12 @@ extra_rdoc_files: []
|
|
45
45
|
files:
|
46
46
|
- .gitignore
|
47
47
|
- Gemfile
|
48
|
+
- History.md
|
48
49
|
- License.txt
|
49
50
|
- README.md
|
50
51
|
- lib/markdown-rails.rb
|
51
|
-
- lib/markdown
|
52
|
-
- lib/markdown
|
52
|
+
- lib/markdown-rails/engine.rb
|
53
|
+
- lib/markdown-rails/version.rb
|
53
54
|
- markdown-rails.gemspec
|
54
55
|
homepage: https://github.com/joliss/markdown-rails
|
55
56
|
licenses: []
|
@@ -1,38 +0,0 @@
|
|
1
|
-
require 'rdiscount'
|
2
|
-
require 'action_view'
|
3
|
-
|
4
|
-
module Markdown
|
5
|
-
module Rails
|
6
|
-
class Handler
|
7
|
-
def initialize
|
8
|
-
end
|
9
|
-
|
10
|
-
def call(template)
|
11
|
-
# Return Ruby code that returns the compiled template
|
12
|
-
Markdown::Rails.renderer.call(template.source).inspect + '.html_safe'
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
class <<self
|
17
|
-
def configure
|
18
|
-
yield self
|
19
|
-
end
|
20
|
-
|
21
|
-
attr_accessor :renderer
|
22
|
-
|
23
|
-
def render(&block)
|
24
|
-
self.renderer = block
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
Markdown::Rails.configure do |config|
|
31
|
-
config.render do |markdown_source|
|
32
|
-
RDiscount.new(markdown_source).to_html
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
handler = Markdown::Rails::Handler.new
|
37
|
-
ActionView::Template.register_template_handler(:md, handler)
|
38
|
-
ActionView::Template.register_template_handler(:markdown, handler)
|