markdowner 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: fc407621c244d535298d5ef7bba49beaf599a4b095132bbfc90d47003401e970
4
+ data.tar.gz: 978c696e6f4dbbe25b72928b6ce7232ec129181b8fad2bc574359f753f506178
5
+ SHA512:
6
+ metadata.gz: 1e71aa8f0072dbde4f967af7296ecf7ed80240b2395cf597985aca3a15a41d37d600161162839a3999bf68ee1b2c9fa8b2bef8cdb8f79fef8a26f1cb9bcfb356
7
+ data.tar.gz: 86094c20030310928836829766e9b00ade5b1264a02c78217b3ba861f7c1ca24fa1d69f981a453f3128a3f2187e7c4364e4addd828c0db0b4c0e47d78dca1af0
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright elpdev
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,56 @@
1
+ # Markdowner
2
+
3
+ Simple rails gem to use Markdown files in your views.
4
+
5
+ ## Usage
6
+
7
+ After installing the gem you can create and use markdown files in your view folders. The markdown files are rendered as html using the redcarpet gem.
8
+
9
+ ### Syntax Highlighting
10
+
11
+ Markdowner comes with the [prismjs](https://prismjs.com/) library for syntax highlighting. You're free to use any other library you like, skip this section and include your own.
12
+
13
+ - To enable it add the following to your layout.
14
+
15
+ ```language-erb
16
+ <%= stylesheet_link_tag 'markdowner/prism', media: 'all' %>
17
+ <%= javascript_include_tag 'markdowner/prism' %>
18
+ ```
19
+
20
+ Then in your markdown file you can use the following syntax for code blocks.
21
+
22
+ ````markdown
23
+ ```language-ruby
24
+ your code here
25
+ ```
26
+ ````
27
+
28
+ <img width="656" alt="image" src="https://github.com/lbp-dev/markdowner/assets/148717241/090a0795-4841-4a5a-8ed6-66f77987c9ab">
29
+
30
+ ## Installation
31
+
32
+ Add this line to your application's Gemfile:
33
+
34
+ ```ruby
35
+ gem "markdowner", path: "../markdowner"
36
+ ```
37
+
38
+ And then execute:
39
+
40
+ ```bash
41
+ bundle
42
+ ```
43
+
44
+ Or install it yourself as:
45
+
46
+ ```bash
47
+ gem install markdowner
48
+ ```
49
+
50
+ ## Contributing
51
+
52
+ Contribution directions go here.
53
+
54
+ ## License
55
+
56
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,5 @@
1
+ require "bundler/setup"
2
+
3
+ load "rails/tasks/statistics.rake"
4
+
5
+ require "bundler/gem_tasks"
@@ -0,0 +1,18 @@
1
+ require_relative "handlers/markdown_handler"
2
+
3
+ module Markdowner
4
+ class Engine < ::Rails::Engine
5
+ isolate_namespace Markdowner
6
+
7
+ initializer "markdowner.markdown_handler" do |app|
8
+ ActionView::Template.register_template_handler(
9
+ :md,
10
+ Markdowner::Handlers::MarkdownHandler.new
11
+ )
12
+ end
13
+
14
+ initializer "markdowner.assets.precompile" do |app|
15
+ app.config.assets.precompile += %w[markdowner/prism.js markdowner/prism.css]
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,30 @@
1
+ require "redcarpet"
2
+
3
+ module Markdowner
4
+ module Handlers
5
+ class MarkdownHandler
6
+ def call(template, source)
7
+ markdown = ::Redcarpet::Markdown.new(
8
+ Redcarpet::Render::HTML,
9
+ autolink: true,
10
+ tables: true,
11
+ fenced_code_blocks: true,
12
+ underline: true,
13
+ highlight: true,
14
+ quote: true,
15
+ footnotes: true,
16
+ no_styles: true,
17
+ hard_wrap: true,
18
+ prettify: true,
19
+ safe_links_only: true,
20
+ no_intra_emphasis: true,
21
+ strikethrough: true,
22
+ superscript: true,
23
+ lax_spacing: true,
24
+ space_after_headers: true
25
+ )
26
+ "#{markdown.render(source).inspect}.html_safe"
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,3 @@
1
+ module Markdowner
2
+ VERSION = "0.1.2"
3
+ end
data/lib/markdowner.rb ADDED
@@ -0,0 +1,6 @@
1
+ require "markdowner/version"
2
+ require "markdowner/engine"
3
+
4
+ module Markdowner
5
+ # Your code goes here...
6
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :markdowner do
3
+ # # Task goes here
4
+ # end
metadata ADDED
@@ -0,0 +1,88 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: markdowner
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.2
5
+ platform: ruby
6
+ authors:
7
+ - elpdev
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2024-06-30 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '7.1'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 7.1.3.4
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '7.1'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 7.1.3.4
33
+ - !ruby/object:Gem::Dependency
34
+ name: redcarpet
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '3.6'
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '3.6'
47
+ description: Rails gem that enables markdown files in your app/views directory.
48
+ email:
49
+ - 148717241+elpdev@users.noreply.github.com
50
+ executables: []
51
+ extensions: []
52
+ extra_rdoc_files: []
53
+ files:
54
+ - MIT-LICENSE
55
+ - README.md
56
+ - Rakefile
57
+ - lib/markdowner.rb
58
+ - lib/markdowner/engine.rb
59
+ - lib/markdowner/handlers/markdown_handler.rb
60
+ - lib/markdowner/version.rb
61
+ - lib/tasks/markdowner_tasks.rake
62
+ homepage: https://github.com/lbp-dev/markdowner
63
+ licenses:
64
+ - MIT
65
+ metadata:
66
+ homepage_uri: https://github.com/lbp-dev/markdowner
67
+ source_code_uri: https://github.com/lbp-dev/markdowner
68
+ changelog_uri: https://github.com/lbp-dev/markdowner/CHANGELOG.md
69
+ post_install_message:
70
+ rdoc_options: []
71
+ require_paths:
72
+ - lib
73
+ required_ruby_version: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ version: '3.0'
78
+ required_rubygems_version: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ requirements: []
84
+ rubygems_version: 3.5.13
85
+ signing_key:
86
+ specification_version: 4
87
+ summary: Handle markdown files in Rails applications.
88
+ test_files: []