emd 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +61 -0
- data/config/initializers/markdown_template_handler.rb +22 -0
- data/lib/emd.rb +22 -0
- data/lib/emd/post_message.rb +13 -0
- data/lib/emd/version.rb +3 -0
- metadata +94 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ad888db5ed6ebd058f0109679ed0c254a8c16983
|
4
|
+
data.tar.gz: e34c2df334b51cc6428c99e68080b77d3b34f124
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 337f029b28177e7302419b9731d9e6fa3356a0cad06f7f5931b2a9c737f3c9834208ba4e2393e97c5b01552b8f9f9f5ce8385fca7817038dfe0db4d6d5aa2be4
|
7
|
+
data.tar.gz: 602cf0d3b273df5fd10df3efbee9c50d44e6a993ef21a12db88a2dde77ca1fe21254baca67d201ce0951fc492ab2f0b3b9ebaa1bbdf5f943e629ec2eba0f0b88
|
data/README.md
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
# emd
|
2
|
+
|
3
|
+
Embedded Markdown is created so that I can use markdown within my own rails projects.
|
4
|
+
|
5
|
+
Embedded Markdown uses a rails engine and a simple initializer to initiate a template handler for markdown using redcarpet.
|
6
|
+
|
7
|
+
Special thanks to [these folks](http://stackoverflow.com/questions/4163560/how-can-i-automatically-render-partials-using-markdown-in-rails-3/10131299#10131299
|
8
|
+
) for making emd possible
|
9
|
+
|
10
|
+
## Example repo
|
11
|
+
|
12
|
+
TODO
|
13
|
+
|
14
|
+
## Installation
|
15
|
+
|
16
|
+
Add this two lines to your application's Gemfile:
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
gem 'redcarpet'
|
20
|
+
gem 'emd'
|
21
|
+
```
|
22
|
+
> emd depends on redcarpet for markdown rendering
|
23
|
+
|
24
|
+
And then execute:
|
25
|
+
|
26
|
+
$ bundle
|
27
|
+
|
28
|
+
Or install it yourself as:
|
29
|
+
|
30
|
+
$ gem install emd
|
31
|
+
|
32
|
+
## Usage
|
33
|
+
|
34
|
+
create a partial app/view/frontpages/`_component.html.md`
|
35
|
+
|
36
|
+
```markdown
|
37
|
+
### This is a component
|
38
|
+
|
39
|
+
- This is item 1
|
40
|
+
- This is iiem 2
|
41
|
+
- [This is a link to google] (http://google.com)
|
42
|
+
|
43
|
+
```
|
44
|
+
|
45
|
+
Then, use this partial using <%= render "component" %> within any view like index.html.erb
|
46
|
+
|
47
|
+
|
48
|
+
## Development
|
49
|
+
|
50
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
51
|
+
|
52
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
53
|
+
|
54
|
+
## Contributing
|
55
|
+
|
56
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/emd. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
57
|
+
|
58
|
+
|
59
|
+
## License
|
60
|
+
|
61
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module MarkdownTemplateHandler
|
2
|
+
def self.erb
|
3
|
+
@erb ||= ActionView::Template.registered_template_handler(:erb)
|
4
|
+
end
|
5
|
+
|
6
|
+
def self.call(template)
|
7
|
+
compiled_source = erb.call(template)
|
8
|
+
"Redcarpet::Markdown.new(Redcarpet::Render::HTML,
|
9
|
+
no_intra_emphasis: true,
|
10
|
+
fenced_code_blocks: true,
|
11
|
+
space_after_headers: true,
|
12
|
+
smartypants: true,
|
13
|
+
disable_indented_code_blocks: true,
|
14
|
+
prettify: true,
|
15
|
+
tables: true,
|
16
|
+
with_toc_data: true,
|
17
|
+
autolink: true).render(begin;#{compiled_source};end).html_safe"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
ActionView::Template.register_template_handler :md, MarkdownTemplateHandler
|
22
|
+
ActionView::Template.register_template_handler :markdown, MarkdownTemplateHandler
|
data/lib/emd.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require "emd/version"
|
2
|
+
require "thor"
|
3
|
+
|
4
|
+
module Emd
|
5
|
+
|
6
|
+
class Engine < ::Rails::Engine
|
7
|
+
end
|
8
|
+
|
9
|
+
class Base < Thor
|
10
|
+
|
11
|
+
desc :test, 'test this'
|
12
|
+
# method_option :group, type: :boolean, aliases: '-g'
|
13
|
+
# method_option :load, type: :string, aliases: '-l'
|
14
|
+
# method_option :save, type: :string, aliases: '-s'
|
15
|
+
# method_option :force, type: :boolean, aliases: '-f'
|
16
|
+
|
17
|
+
def test(arg = nil)
|
18
|
+
puts "test"
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Log
|
2
|
+
MESSAGE = "
|
3
|
+
|
4
|
+
███████╗███╗ ███╗██████╗
|
5
|
+
██╔════╝████╗ ████║██╔══██╗
|
6
|
+
█████╗ ██╔████╔██║██║ ██║
|
7
|
+
██╔══╝ ██║╚██╔╝██║██║ ██║
|
8
|
+
███████╗██║ ╚═╝ ██║██████╔╝
|
9
|
+
╚══════╝╚═╝ ╚═╝╚═════╝
|
10
|
+
|
11
|
+
Send me pull request -> https://github.com/ytbryan/emd/pulls
|
12
|
+
"
|
13
|
+
end
|
data/lib/emd/version.rb
ADDED
metadata
ADDED
@@ -0,0 +1,94 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: emd
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Bryan Lim
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-12-29 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: redcarpet
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.11'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.11'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
description: mbedded markdown template for Ruby on Rails
|
56
|
+
email:
|
57
|
+
- ytbryan@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- README.md
|
63
|
+
- config/initializers/markdown_template_handler.rb
|
64
|
+
- lib/emd.rb
|
65
|
+
- lib/emd/post_message.rb
|
66
|
+
- lib/emd/version.rb
|
67
|
+
homepage: ''
|
68
|
+
licenses:
|
69
|
+
- MIT
|
70
|
+
metadata: {}
|
71
|
+
post_install_message: "\n\n ███████╗███╗ ███╗██████╗\n ██╔════╝████╗ ████║██╔══██╗\n
|
72
|
+
\ █████╗ ██╔████╔██║██║ ██║\n ██╔══╝ ██║╚██╔╝██║██║ ██║\n ███████╗██║ ╚═╝
|
73
|
+
██║██████╔╝\n ╚══════╝╚═╝ ╚═╝╚═════╝\n \n Send
|
74
|
+
me pull request -> https://github.com/ytbryan/emd/pulls\n "
|
75
|
+
rdoc_options: []
|
76
|
+
require_paths:
|
77
|
+
- lib
|
78
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - ">="
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
requirements: []
|
89
|
+
rubyforge_project:
|
90
|
+
rubygems_version: 2.5.2
|
91
|
+
signing_key:
|
92
|
+
specification_version: 4
|
93
|
+
summary: Embedded markdown template for Ruby on Rails
|
94
|
+
test_files: []
|