viewmd 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: def90ea77cc1d012d5715ade12cf309f50c1e5bb
4
- data.tar.gz: 6cc5b29e5e42b08043e93a54973081dff2249e9c
3
+ metadata.gz: 7be3c05b0aaa2b6b2bda0a81620064159ce58d66
4
+ data.tar.gz: 1ea291a7e59697181ae36496b3a1f883bed176b5
5
5
  SHA512:
6
- metadata.gz: 6a291e71610a7edf45d32acaeee2820c18d0187075be89998979cf276854cb6774a0274bc6a1885c41716dc933f0d37540dd616fc26dc064a06b0ee5b780e059
7
- data.tar.gz: 210f7cb1d9144ea120276c08b47ffd7c39f1e1b46dbb40d3c1928f27c984e6a7c2a0cd536fba36a3b721bab0c60ef88e913b26a55ef46a2e3e52cdaaa8c60142
6
+ metadata.gz: f145c2a21bb119ed3400bbab50eadeceabd1b734c3ad77a395c3fdf403c245853f0d56e976920990752fa7ba6d6a66b66bbcdfda397b18f6e95df0cd494f23b2
7
+ data.tar.gz: 3be059a0d417ab6859f5e2776a7c3894da5679fa1850fb9878f486a2fae1f57dde80058e505cd6a1af2d2fbbcd0df95cb997147e746807e5aae3559a8c8fde88
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Viewmd
2
2
 
3
- Viewmd is a command line tool for viewing your Markdown files (e.g. README.md) in your local browser. Uses [GitHub dialect](https://help.github.com/articles/github-flavored-markdown) of Markdown, so the result should look very close to what you'd see on Github if you put the file on GitHub.
3
+ Viewmd is a command line tool for viewing your Markdown files (e.g. README.md) in your local browser. Uses [GitHub dialect](https://help.github.com/articles/github-flavored-markdown) of Markdown and some elements of [GitHub CSS for syntax highlighting](https://github.com/aahan/pygments-github-style), so the result should resemble what you'd see on Github once you commit the file.
4
4
 
5
5
  I guess, we all hate committing files with bugs. In case of Markdown files, like README.md, it's possible to make some little mistake while editing the file (e.g. forget the trailing triple-backticks) and end up with an incorrectly formatted file checked in to your repository. Seeing it only on GitHub already, for example, and having to do another little fix & commit just to fix this little formatting mistake seens like an untidy process to me. Thus I created this really simple command-line tool to see how the file would look like *before* committing.
6
6
 
@@ -10,17 +10,9 @@ Please note that I tested it on MacOS only. If you use other OS in your developm
10
10
 
11
11
  ## Installation
12
12
 
13
- If you prefer managing your tools through your application's Gemfile, add this line there:
13
+ This gem has many GitHub-specific dependencies (primarily, due to the use of [html-pipeline](https://github.com/jch/html-pipeline)). So, gem version conflicts are quite likely if you try to install this tool using Gemfile.
14
14
 
15
- ```ruby
16
- gem 'viewmd', group: :development, require: false
17
- ```
18
-
19
- And then execute:
20
-
21
- $ bundle
22
-
23
- Or, better yet, as with all generic dev-tools, install the gem yourself environment-wide as:
15
+ Install the gem yourself environment-wide as:
24
16
 
25
17
  $ gem install viewmd
26
18
 
@@ -43,9 +35,14 @@ The public API should not be considered stable.
43
35
 
44
36
  ## Dependencies
45
37
 
46
- * [github-markup](https://github.com/github/markup)
38
+ * [html-pipeline](https://github.com/jch/html-pipeline)
47
39
  * [github-markdown](https://rubygems.org/gems/github-markdown)
40
+ * [github-linguist](https://github.com/github/linguist)
41
+ * [pygments.rb](https://github.com/tmm1/pygments.rb)
42
+ * [rinku](https://github.com/vmg/rinku)
43
+ * [sanitize](https://github.com/rgrove/sanitize)
48
44
  * [launchy](https://github.com/copiousfreetime/launchy)
45
+ * CSS from [pygments-github-style](https://github.com/aahan/pygments-github-style)
49
46
 
50
47
  ## Contributing
51
48
 
@@ -1,12 +1,28 @@
1
1
  require 'viewmd/version'
2
- require 'github/markup'
2
+ require 'html/pipeline'
3
+
4
+ require 'pygments.rb'
5
+
3
6
  require 'launchy'
4
7
  require 'tempfile'
8
+ require 'open-uri'
5
9
 
6
10
  module Viewmd
7
11
  def self.view(name)
8
- Tempfile.create(['viewmd','.htm'],Dir.tmpdir,File::CREAT|File::TRUNC|File::RDWR, 0600) do |f|
9
- f << GitHub::Markup.render(name, File.read(name))
12
+ Tempfile.create(["viewmd-#{name}-",'.htm'],Dir.tmpdir,File::CREAT|File::TRUNC|File::RDWR, 0600) do |f|
13
+ pipeline = HTML::Pipeline.new [
14
+ HTML::Pipeline::MarkdownFilter,
15
+ HTML::Pipeline::SanitizationFilter,
16
+ HTML::Pipeline::AutolinkFilter,
17
+ HTML::Pipeline::SyntaxHighlightFilter
18
+ ], gfm: true
19
+ result = pipeline.call File.read(name)
20
+ f << "<!DOCTYPE html><html><head><style>"
21
+ f << "pre { background-color: #f7f7f7; padding: 16px; font-size: 85%; margin-bottom: 16px; line-height: 1.45; }"
22
+ f << open('https://raw.githubusercontent.com/aahan/pygments-github-style/master/github.css').read
23
+ f << "</style></head><body>"
24
+ f << result[:output].to_s
25
+ f << "</body></html>"
10
26
  f.flush
11
27
  Launchy.open(f.path)
12
28
  # joining the launchy thread doesn't help to wait for browser to close before deleting the file
@@ -1,3 +1,3 @@
1
1
  module Viewmd
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
8
8
  spec.version = Viewmd::VERSION
9
9
  spec.authors = ['moonfly (Andrey Pronin)']
10
10
  spec.email = ['moonfly.msk@gmail.com']
11
- spec.summary = %q{Command line tool for viewing Markdown files (GitHub Markup) in a browser}
12
- spec.description = %q{Command line tool for viewing Markdown files (GitHub Markup) in a browser}
11
+ spec.summary = %q{Command line tool for viewing Markdown files (with GitHub Markdown extensions) in a browser}
12
+ spec.description = %q{Command line tool for viewing Markdown files (with GitHub Markdown extensions) in a browser}
13
13
  spec.homepage = 'https://github.com/moonfly/viewmd'
14
14
  spec.license = "MIT"
15
15
 
@@ -25,12 +25,14 @@ Gem::Specification.new do |spec|
25
25
  spec.rdoc_options = ['--charset=UTF-8']
26
26
  spec.extra_rdoc_files = %w[README.md CONTRIBUTORS.md LICENSE.md]
27
27
 
28
- spec.add_dependency 'github-markup', '>= 1.3'
29
28
  spec.add_dependency 'launchy', '>= 2.4'
30
29
  spec.add_dependency 'github-markdown', '>= 0.6'
30
+ spec.add_dependency 'html-pipeline', '>= 1.11'
31
+ spec.add_dependency 'pygments.rb', '>= 0.6'
32
+ spec.add_dependency 'github-linguist', '>= 3.1'
33
+ spec.add_dependency 'rinku', '>= 1.7'
34
+ spec.add_dependency 'sanitize', '>= 3.0'
31
35
 
32
36
  spec.add_development_dependency "bundler", ">= 1.6"
33
37
  spec.add_development_dependency "rake"
34
- spec.add_development_dependency 'rspec', '~> 3.0'
35
- spec.add_development_dependency 'coveralls'
36
38
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: viewmd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - moonfly (Andrey Pronin)
@@ -11,35 +11,49 @@ cert_chain: []
11
11
  date: 2014-09-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: github-markup
14
+ name: launchy
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.3'
19
+ version: '2.4'
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: '1.3'
26
+ version: '2.4'
27
27
  - !ruby/object:Gem::Dependency
28
- name: launchy
28
+ name: github-markdown
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '2.4'
33
+ version: '0.6'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '2.4'
40
+ version: '0.6'
41
41
  - !ruby/object:Gem::Dependency
42
- name: github-markdown
42
+ name: html-pipeline
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '1.11'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '1.11'
55
+ - !ruby/object:Gem::Dependency
56
+ name: pygments.rb
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
59
  - - ">="
@@ -53,49 +67,63 @@ dependencies:
53
67
  - !ruby/object:Gem::Version
54
68
  version: '0.6'
55
69
  - !ruby/object:Gem::Dependency
56
- name: bundler
70
+ name: github-linguist
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
73
  - - ">="
60
74
  - !ruby/object:Gem::Version
61
- version: '1.6'
62
- type: :development
75
+ version: '3.1'
76
+ type: :runtime
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
80
  - - ">="
67
81
  - !ruby/object:Gem::Version
68
- version: '1.6'
82
+ version: '3.1'
69
83
  - !ruby/object:Gem::Dependency
70
- name: rake
84
+ name: rinku
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
87
  - - ">="
74
88
  - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
89
+ version: '1.7'
90
+ type: :runtime
77
91
  prerelease: false
78
92
  version_requirements: !ruby/object:Gem::Requirement
79
93
  requirements:
80
94
  - - ">="
81
95
  - !ruby/object:Gem::Version
82
- version: '0'
96
+ version: '1.7'
83
97
  - !ruby/object:Gem::Dependency
84
- name: rspec
98
+ name: sanitize
85
99
  requirement: !ruby/object:Gem::Requirement
86
100
  requirements:
87
- - - "~>"
101
+ - - ">="
88
102
  - !ruby/object:Gem::Version
89
103
  version: '3.0'
90
- type: :development
104
+ type: :runtime
91
105
  prerelease: false
92
106
  version_requirements: !ruby/object:Gem::Requirement
93
107
  requirements:
94
- - - "~>"
108
+ - - ">="
95
109
  - !ruby/object:Gem::Version
96
110
  version: '3.0'
97
111
  - !ruby/object:Gem::Dependency
98
- name: coveralls
112
+ name: bundler
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '1.6'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '1.6'
125
+ - !ruby/object:Gem::Dependency
126
+ name: rake
99
127
  requirement: !ruby/object:Gem::Requirement
100
128
  requirements:
101
129
  - - ">="
@@ -108,7 +136,8 @@ dependencies:
108
136
  - - ">="
109
137
  - !ruby/object:Gem::Version
110
138
  version: '0'
111
- description: Command line tool for viewing Markdown files (GitHub Markup) in a browser
139
+ description: Command line tool for viewing Markdown files (with GitHub Markdown extensions)
140
+ in a browser
112
141
  email:
113
142
  - moonfly.msk@gmail.com
114
143
  executables:
@@ -153,5 +182,6 @@ rubyforge_project:
153
182
  rubygems_version: 2.2.2
154
183
  signing_key:
155
184
  specification_version: 4
156
- summary: Command line tool for viewing Markdown files (GitHub Markup) in a browser
185
+ summary: Command line tool for viewing Markdown files (with GitHub Markdown extensions)
186
+ in a browser
157
187
  test_files: []