markdown-rails 2.0.0.alpha2 → 2.0.0.alpha4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -9
- data/lib/generators/markdown/install/templates/app/markdown/application_markdown.rb +2 -2
- data/lib/generators/markdown/install/templates/config/initializers/markdown.rb +2 -2
- data/lib/markdown/rails/{handlers → handler}/erb.rb +1 -1
- data/lib/markdown/rails/{handlers → handler}/markdown.rb +1 -1
- data/lib/markdown/rails/{renderers → renderer}/base.rb +2 -2
- data/lib/markdown/rails/{renderers → renderer}/rails.rb +1 -1
- data/lib/markdown/rails/version.rb +1 -1
- data/lib/markdown/rails.rb +7 -7
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df9409534d893fd18f8ea4312fae865d4d228387217d83976a108c1eca3bcb4a
|
4
|
+
data.tar.gz: 943cae0bd4ef19becaa5e243d59982c073fd5a8a1f3f066a7da8ecb5d274cdc8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c985143f8649306207650a0d3ae6eb4f0e317bbe1fb3592c94fc67b94f441d2b0ad08072ce0e45b32001f10e6164e9a04e54eafc1437a60d87ffc939d614cc2
|
7
|
+
data.tar.gz: f71fb88d71fc8ca3ea0eb443934c57724d8584a502a9786ccd8e2cfdef1f98de4eaf24cc72fe07dacb55a7ea8a3f13a38464c44fe6bf2be4b473fcc812d573d2
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# markdown-rails
|
2
2
|
|
3
3
|
> **Note**
|
4
|
-
> **Everything below is implemented in 2.0.0.
|
4
|
+
> **Everything below is implemented in 2.0.0.alpha.** . You can start using this by adding to `gem "markdown-rails", version: "2.0.0.alpha"` to your Gemfile or by looking at it being used in the https://github.com/bradgessler/view-playground repo.
|
5
5
|
|
6
6
|
This gem allows you to write static Rails views and partials using the [Markdown](http://daringfireball.net/projects/markdown/syntax) syntax. No more editing prose in HTML!
|
7
7
|
|
@@ -29,7 +29,7 @@ Then from the root of your Rails project, run:
|
|
29
29
|
$ bin/rails g markdown:install
|
30
30
|
```
|
31
31
|
|
32
|
-
This adds a `config/initializers/markdown.rb` file where you can register template
|
32
|
+
This adds a `config/initializers/markdown.rb` file where you can register template handler for your Markdown renders that are located in `./app/markdown/*.rb`.
|
33
33
|
|
34
34
|
Now add views or partials ending in `.md` in your `./app/views/**/**` directories and behold!
|
35
35
|
|
@@ -57,7 +57,7 @@ Applications commonly need various markdown variants within one application. For
|
|
57
57
|
# ./config/initializers/markdown.rb
|
58
58
|
# Restart the server to see changes made to this file.
|
59
59
|
|
60
|
-
# Setup markdown stacks to work with different template
|
60
|
+
# Setup markdown stacks to work with different template handler in Rails.
|
61
61
|
Markdown::Rails.handle :md do
|
62
62
|
ApplicationMarkdown.new
|
63
63
|
end
|
@@ -71,11 +71,11 @@ end
|
|
71
71
|
|
72
72
|
Only enable Erb in Markdown if you trust the source of the file. Do not enable it for markdown provided by users or they will be able to execute arbitrary Ruby code.
|
73
73
|
|
74
|
-
To enable Erb, you can tell Rails to render all view files ending with `.markerb` using the `Markdown::Rails::
|
74
|
+
To enable Erb, you can tell Rails to render all view files ending with `.markerb` using the `Markdown::Rails::Handler::Erb` handler.
|
75
75
|
|
76
76
|
```ruby
|
77
77
|
# ./config/initializers/markdown.rb
|
78
|
-
Markdown::Rails.handle :markerb, with: Markdown::Rails::
|
78
|
+
Markdown::Rails.handle :markerb, with: Markdown::Rails::Handler::Erb do
|
79
79
|
ApplicationMarkdown.new
|
80
80
|
end
|
81
81
|
```
|
@@ -86,19 +86,19 @@ You *could* change `:markerb` to `:md`, but I don't recommend it for all Markdow
|
|
86
86
|
# ./config/initializers/markdown.rb
|
87
87
|
# Restart the server to see changes made to this file.
|
88
88
|
|
89
|
-
# Setup markdown stacks to work with different template
|
89
|
+
# Setup markdown stacks to work with different template handler in Rails.
|
90
90
|
Markdown::Rails.handle :md do
|
91
91
|
ApplicationMarkdown.new
|
92
92
|
end
|
93
93
|
|
94
|
-
Markdown::Rails.handle :markerb, with: Markdown::Rails::
|
94
|
+
Markdown::Rails.handle :markerb, with: Markdown::Rails::Handler::Erb do
|
95
95
|
ApplicationMarkdown.new
|
96
96
|
end
|
97
97
|
```
|
98
98
|
|
99
|
-
## Customizing
|
99
|
+
## Customizing renderer
|
100
100
|
|
101
|
-
You might want to customize your Markdown
|
101
|
+
You might want to customize your Markdown handler to do things like syntax code highlighting, etc.
|
102
102
|
|
103
103
|
```ruby
|
104
104
|
# ./app/markdown/application_markdown.rb
|
@@ -1,13 +1,13 @@
|
|
1
1
|
# You should read the docs at https://github.com/vmg/redcarpet and probably
|
2
2
|
# delete a bunch of stuff below if you don't need it.
|
3
3
|
|
4
|
-
class ApplicationMarkdown < Markdown::Rails::
|
4
|
+
class ApplicationMarkdown < Markdown::Rails::Renderer::Rails
|
5
5
|
# Reformats your boring punctation like " and " into “ and ” so you can look
|
6
6
|
# and feel smarter. Read the docs at https://github.com/vmg/redcarpet#also-now-our-pants-are-much-smarter
|
7
7
|
include Redcarpet::Render::SmartyPants
|
8
8
|
|
9
9
|
# If you need access to ActionController::Base.helpers, you can delegate by uncommenting
|
10
|
-
# and adding to the list below. Several are already included for you in the `Markdown::Rails::
|
10
|
+
# and adding to the list below. Several are already included for you in the `Markdown::Rails::Renderer::Rails`,
|
11
11
|
# but you can add more here.
|
12
12
|
#
|
13
13
|
# To see a list of methods available run `bin/rails runner "puts ActionController::Base.helpers.public_methods.sort"`
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# Restart the server to see changes made to this file.
|
2
2
|
|
3
|
-
# Setup markdown stacks to work with different template
|
3
|
+
# Setup markdown stacks to work with different template handler in Rails.
|
4
4
|
Markdown::Rails.handle :md, :markdown do
|
5
5
|
ApplicationMarkdown.new
|
6
6
|
end
|
@@ -8,6 +8,6 @@ end
|
|
8
8
|
# Don't use Erb for untrusted markdown content created by users; otherwise they
|
9
9
|
# can execute arbitrary code on your server. This should only be used for input you
|
10
10
|
# trust, like content files from your code repo.
|
11
|
-
Markdown::Rails.handle :markerb, with: Markdown::Rails::
|
11
|
+
Markdown::Rails.handle :markerb, with: Markdown::Rails::Handler::Erb do
|
12
12
|
ApplicationMarkdown.new
|
13
13
|
end
|
@@ -1,10 +1,10 @@
|
|
1
1
|
module Markdown
|
2
2
|
module Rails
|
3
|
-
module
|
3
|
+
module Renderer
|
4
4
|
class Base < Redcarpet::Render::HTML
|
5
5
|
def enable
|
6
6
|
# This is a very restrictive Markdown renderer that errs on the side of safety.
|
7
|
-
# For more details read the docs at https://github.com/vmg/redcarpet#darling-i-packed-you-a-couple-
|
7
|
+
# For more details read the docs at https://github.com/vmg/redcarpet#darling-i-packed-you-a-couple-renderer-for-lunch
|
8
8
|
[
|
9
9
|
:filter_html,
|
10
10
|
:no_images,
|
data/lib/markdown/rails.rb
CHANGED
@@ -3,18 +3,18 @@ require "markdown/rails/engine"
|
|
3
3
|
|
4
4
|
module Markdown
|
5
5
|
module Rails
|
6
|
-
def self.handle(*extensions, with:
|
6
|
+
def self.handle(*extensions, with: Handler::Markdown, &block)
|
7
7
|
with.handle *extensions, &block
|
8
8
|
end
|
9
9
|
|
10
|
-
module
|
11
|
-
autoload :Markdown, "markdown/rails/
|
12
|
-
autoload :Erb, "markdown/rails/
|
10
|
+
module Handler
|
11
|
+
autoload :Markdown, "markdown/rails/handler/markdown"
|
12
|
+
autoload :Erb, "markdown/rails/handler/erb"
|
13
13
|
end
|
14
14
|
|
15
|
-
module
|
16
|
-
autoload :Base, "markdown/rails/
|
17
|
-
autoload :Rails, "markdown/rails/
|
15
|
+
module Renderer
|
16
|
+
autoload :Base, "markdown/rails/renderer/base"
|
17
|
+
autoload :Rails, "markdown/rails/renderer/rails"
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
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: 2.0.0.
|
4
|
+
version: 2.0.0.alpha4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brad Gessler
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 6.0.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 6.0.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: redcarpet
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -57,11 +57,11 @@ files:
|
|
57
57
|
- lib/markdown-rails.rb
|
58
58
|
- lib/markdown/rails.rb
|
59
59
|
- lib/markdown/rails/engine.rb
|
60
|
-
- lib/markdown/rails/
|
61
|
-
- lib/markdown/rails/
|
60
|
+
- lib/markdown/rails/handler/erb.rb
|
61
|
+
- lib/markdown/rails/handler/markdown.rb
|
62
62
|
- lib/markdown/rails/railtie.rb
|
63
|
-
- lib/markdown/rails/
|
64
|
-
- lib/markdown/rails/
|
63
|
+
- lib/markdown/rails/renderer/base.rb
|
64
|
+
- lib/markdown/rails/renderer/rails.rb
|
65
65
|
- lib/markdown/rails/version.rb
|
66
66
|
- lib/tasks/markdown/rails_tasks.rake
|
67
67
|
homepage: https://github.com/sitepress/markdown-rails
|