octodown 1.0.3 → 1.0.5.pre1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/octodown +5 -0
- data/lib/octodown/support/helpers.rb +1 -1
- data/lib/octodown/template/octodown.html.erb +1 -0
- data/lib/octodown/version.rb +1 -1
- metadata +22 -51
- checksums.yaml.gz.sig +0 -2
- data/.gitignore +0 -14
- data/.rspec +0 -2
- data/.rubocop.yml +0 -15
- data/.travis.yml +0 -13
- data/Gemfile +0 -4
- data/LICENSE.txt +0 -22
- data/README.md +0 -87
- data/Rakefile +0 -53
- data/octodown.gemspec +0 -32
- data/spec/browser_spec.rb +0 -10
- data/spec/dummy/test.md +0 -14
- data/spec/markdown_generation_spec.rb +0 -44
- data/spec/relative_root_filter_spec.rb +0 -26
- data/spec/spec_helper.rb +0 -12
- data/spec/template_rendering_spec.rb +0 -30
- data.tar.gz.sig +0 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 85635396b97608fe567e949028665d9e6d3104ee
|
4
|
+
data.tar.gz: e0c1640e615c20568dcc2350251ae31885755419
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a97b8900922dc4efe5e8abf89959ecf837801babeb138933b38b04b7ec4ef91e2221de22d5f9afcc799b91cdb5e4fbdb40e19a5b653179cc6e84a2b402e772ae
|
7
|
+
data.tar.gz: 0bf7c1c8345e504511abd280bb143a45b767e00420cb2f8acb15c67d18b8dd23616a1a021e95ae7d820755647939c5a9e043a3289b91daf3900c30ce9cbbe155
|
data/bin/octodown
CHANGED
@@ -10,6 +10,11 @@ options = {}
|
|
10
10
|
OptionParser.new do |opts|
|
11
11
|
opts.banner = 'Usage: octodown [options]'
|
12
12
|
|
13
|
+
opts.on_tail('--version', 'Show version') do
|
14
|
+
puts "octodown v#{Octodown::VERSION}"
|
15
|
+
exit
|
16
|
+
end
|
17
|
+
|
13
18
|
opts.on(
|
14
19
|
'-s', '--style [STYLE]', [:github, :atom], 'Choose style (atom, github)'
|
15
20
|
) do |s|
|
@@ -6,7 +6,7 @@ module Octodown
|
|
6
6
|
# TODO: Find a better home for this logic
|
7
7
|
def self.markdown_to_html(content, options, path)
|
8
8
|
html = markdown_to_raw_html(content, options, path)
|
9
|
-
tmp = Octodown::Support::HTMLFile.new 'octodown'
|
9
|
+
tmp = Octodown::Support::HTMLFile.new ['octodown', '.html']
|
10
10
|
tmp.persistent_write html
|
11
11
|
end
|
12
12
|
|
data/lib/octodown/version.rb
CHANGED
metadata
CHANGED
@@ -1,36 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: octodown
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5.pre1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ian Ker-Seymer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
|
-
cert_chain:
|
11
|
-
-
|
12
|
-
-----BEGIN CERTIFICATE-----
|
13
|
-
MIIDfDCCAmSgAwIBAgIBATANBgkqhkiG9w0BAQUFADBCMRQwEgYDVQQDDAtpLmtl
|
14
|
-
cnNleW1lcjEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYD
|
15
|
-
Y29tMB4XDTE0MTIxOTA3MjMxOFoXDTE1MTIxOTA3MjMxOFowQjEUMBIGA1UEAwwL
|
16
|
-
aS5rZXJzZXltZXIxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixk
|
17
|
-
ARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKVwZDJ78nh4
|
18
|
-
49fzhIhSG4hjXcMU2KWwEQIWXp1gESBSvj4NrcygsNvo+y+cbsxB021Fbtw4D1m/
|
19
|
-
Lhqxs8l0MewdaDxwIARu57e+hSX9DpwuDSJzoOBfpWpvdj9QOT0ByeGARCD3Dz4P
|
20
|
-
l4zsZW2HYK3/zWdWznwjh6Jlb/zQaWUgJBanMs15IODVpJ01IW2YqNxDgE1/aaiv
|
21
|
-
kcEE04a3XlNXvRqz0EtDgg6EJdsArVFdtoxT8IGBEvgiltiXusNWfRdAFdtU+Phg
|
22
|
-
Wt/zC43O+nMc8vKQIf7z8gY6ESFTLKYKZEKSAQMzK0EtN/QiTPrrUFLL9WZ4VACg
|
23
|
-
lLmpPiOdIGsCAwEAAaN9MHswCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0O
|
24
|
-
BBYEFE9Q3qbzppIUo0ihetWNmRiDLUV8MCAGA1UdEQQZMBeBFWkua2Vyc2V5bWVy
|
25
|
-
QGdtYWlsLmNvbTAgBgNVHRIEGTAXgRVpLmtlcnNleW1lckBnbWFpbC5jb20wDQYJ
|
26
|
-
KoZIhvcNAQEFBQADggEBAHn26tJwdKaN5Rz8nI6weXyYhvdm9zH1RGD4/ksMPbvu
|
27
|
-
nX16vDqnXHM5KHeC1NgS1ESRlQ0grI5VZlNstFjQXFqbsdAP+UfsnLGpZc4x4C2O
|
28
|
-
gTyUm/TyRZpgGdauRjoR2arPc5M5RDp1xY2XsXKfdWyWlZt0CnKrTezSCyNriHZC
|
29
|
-
8lBhjW73DtD3kmT411PpnN2GMaQQ3svM03XFBQUdyw0gvrKFRv56nVCrGND+KSs3
|
30
|
-
YGBeYMyEy7Q4wf7k4k5yyDUZyyaeg0DF/kNEN5llspJ9DHMP2cQqOiH+IQSNiUhR
|
31
|
-
32sJqaZRHeJLDhZPLi5yXItTsQnPy6uob2oyypwFYTM=
|
32
|
-
-----END CERTIFICATE-----
|
33
|
-
date: 2015-01-14 00:00:00.000000000 Z
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-01-22 00:00:00.000000000 Z
|
34
12
|
dependencies:
|
35
13
|
- !ruby/object:Gem::Dependency
|
36
14
|
name: github-markup
|
@@ -186,6 +164,20 @@ dependencies:
|
|
186
164
|
- - "~>"
|
187
165
|
- !ruby/object:Gem::Version
|
188
166
|
version: '10.0'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: octokit
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - ">="
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - ">="
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0'
|
189
181
|
description:
|
190
182
|
email:
|
191
183
|
- i.kerseymer@gmail.com
|
@@ -194,14 +186,6 @@ executables:
|
|
194
186
|
extensions: []
|
195
187
|
extra_rdoc_files: []
|
196
188
|
files:
|
197
|
-
- ".gitignore"
|
198
|
-
- ".rspec"
|
199
|
-
- ".rubocop.yml"
|
200
|
-
- ".travis.yml"
|
201
|
-
- Gemfile
|
202
|
-
- LICENSE.txt
|
203
|
-
- README.md
|
204
|
-
- Rakefile
|
205
189
|
- assets/atom.css
|
206
190
|
- assets/favicon.png
|
207
191
|
- assets/github.css
|
@@ -216,13 +200,6 @@ files:
|
|
216
200
|
- lib/octodown/support/relative_root_filter.rb
|
217
201
|
- lib/octodown/template/octodown.html.erb
|
218
202
|
- lib/octodown/version.rb
|
219
|
-
- octodown.gemspec
|
220
|
-
- spec/browser_spec.rb
|
221
|
-
- spec/dummy/test.md
|
222
|
-
- spec/markdown_generation_spec.rb
|
223
|
-
- spec/relative_root_filter_spec.rb
|
224
|
-
- spec/spec_helper.rb
|
225
|
-
- spec/template_rendering_spec.rb
|
226
203
|
homepage: https://github.com/ianks/octodown
|
227
204
|
licenses:
|
228
205
|
- MIT
|
@@ -238,19 +215,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
238
215
|
version: '0'
|
239
216
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
240
217
|
requirements:
|
241
|
-
- - "
|
218
|
+
- - ">"
|
242
219
|
- !ruby/object:Gem::Version
|
243
|
-
version:
|
220
|
+
version: 1.3.1
|
244
221
|
requirements: []
|
245
222
|
rubyforge_project:
|
246
|
-
rubygems_version: 2.
|
223
|
+
rubygems_version: 2.2.2
|
247
224
|
signing_key:
|
248
225
|
specification_version: 4
|
249
|
-
summary:
|
250
|
-
test_files:
|
251
|
-
- spec/browser_spec.rb
|
252
|
-
- spec/dummy/test.md
|
253
|
-
- spec/markdown_generation_spec.rb
|
254
|
-
- spec/relative_root_filter_spec.rb
|
255
|
-
- spec/spec_helper.rb
|
256
|
-
- spec/template_rendering_spec.rb
|
226
|
+
summary: GitHub Markdown straight from your shell.
|
227
|
+
test_files: []
|
checksums.yaml.gz.sig
DELETED
data/.gitignore
DELETED
data/.rspec
DELETED
data/.rubocop.yml
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
AllCops:
|
2
|
-
Exclude:
|
3
|
-
- 'octodown.gemspec'
|
4
|
-
- 'Rakefile'
|
5
|
-
|
6
|
-
Style/Documentation:
|
7
|
-
Description: 'Document classes and non-namespace modules.'
|
8
|
-
Enabled: false
|
9
|
-
|
10
|
-
Style/HashSyntax:
|
11
|
-
Description: >-
|
12
|
-
Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax
|
13
|
-
{ :a => 1, :b => 2 }.
|
14
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#hash-literals'
|
15
|
-
Enabled: false
|
data/.travis.yml
DELETED
data/Gemfile
DELETED
data/LICENSE.txt
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
Copyright (c) 2014 Ian Ker-Seymer
|
2
|
-
|
3
|
-
MIT License
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
a copy of this software and associated documentation files (the
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
11
|
-
the following conditions:
|
12
|
-
|
13
|
-
The above copyright notice and this permission notice shall be
|
14
|
-
included in all copies or substantial portions of the Software.
|
15
|
-
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
DELETED
@@ -1,87 +0,0 @@
|
|
1
|
-
:octocat: octodown
|
2
|
-
==================
|
3
|
-
|
4
|
-
[![GemVersion](https://badge.fury.io/rb/octodown.svg)](http://badge.fury.io/rb/octodown)
|
5
|
-
[![Build Status](https://travis-ci.org/ianks/octodown.svg)](https://travis-ci.org/ianks/octodown)
|
6
|
-
|
7
|
-
|
8
|
-
Ever wanted to easily preview what you markdown would look like _exactly_ on
|
9
|
-
Github? Ever wanted to do that from inside of a Terminal? Well this Gem is for
|
10
|
-
you. Dead simple. Never get caught writing ugly markdown again.
|
11
|
-
|
12
|
-
Octodown uses the same parsers and CSS and Github uses for their markdown
|
13
|
-
rendering. Github markdown styling looks beautiful, so it is Octodown's
|
14
|
-
primary goal to reproduce it as faithfully as possible.
|
15
|
-
|
16
|
-
![Octodown GIF](assets/octodown.gif?raw=true)
|
17
|
-
|
18
|
-
-------------------------------------------------------------------------------
|
19
|
-
|
20
|
-
## Features:
|
21
|
-
|
22
|
-
- Uses the same markdown parsers and CSS as Github for true duplication.
|
23
|
-
- Yes emojis _are_ included. :smiling_imp:
|
24
|
-
|
25
|
-
- Fast. `octodown` uses native parsers to ensure performance.
|
26
|
-
- Multiple CSS styles.
|
27
|
-
- `octodown --style atom README.md`
|
28
|
-
- The `--github` markdown (default)
|
29
|
-
- The `--atom` text editor markdown
|
30
|
-
|
31
|
-
- Properly parses `STDIN`.
|
32
|
-
- `cat README.md | octodown`
|
33
|
-
|
34
|
-
## Installation
|
35
|
-
|
36
|
-
1. Install `icu4c` and `cmake`:
|
37
|
-
- Mac: `brew install icu4c cmake pkg-config`
|
38
|
-
- Apt: `sudo apt-get install -y libicu-dev cmake pkg-config`
|
39
|
-
|
40
|
-
2. Install octodown:
|
41
|
-
- If you have a non-system Ruby (_highly recommended_): `gem install
|
42
|
-
octodown`
|
43
|
-
- Else: `sudo gem install octodown`
|
44
|
-
|
45
|
-
4. Install in VIM (_optional_):
|
46
|
-
- Use [Dispatch](https://github.com/tpope/vim-dispatch) and add this to
|
47
|
-
your .vimrc:
|
48
|
-
|
49
|
-
```viml
|
50
|
-
" Use octodown as default build command for Markdown files
|
51
|
-
autocmd FileType markdown let b:dispatch = 'octodown %'
|
52
|
-
```
|
53
|
-
- Caveat: make sure you follow the directions on the Dispatch README.md and
|
54
|
-
make sure that the correct version of Ruby (the one which as Octodown
|
55
|
-
install as a Gem), is used.
|
56
|
-
|
57
|
-
## Usage
|
58
|
-
|
59
|
-
1. Basic:
|
60
|
-
- `octodown README.md`
|
61
|
-
|
62
|
-
2. Markdown preview styling:
|
63
|
-
- `octodown --style atom README.md`
|
64
|
-
|
65
|
-
3. *nix lovers:
|
66
|
-
- `echo '# Hello world!' | octodown --raw > index.html`
|
67
|
-
|
68
|
-
## Notes
|
69
|
-
|
70
|
-
1. With no arguments given, octodown will read `STDIN` until `EOF` is reached.
|
71
|
-
- In order to work with this mode, type what you want into the input, then press
|
72
|
-
`Ctrl-D` when finished.
|
73
|
-
2. `octodown` attempts to use default OS support for opening HTML files from
|
74
|
-
terminal. In Mac, this would be the `open` command; for Linux it is either
|
75
|
-
`xdg-open` or `x-www-browser`. If these are not set, octodown will not
|
76
|
-
automatically open the file in the browser. If octodown doesn't have the
|
77
|
-
commands neccesary to open files in a browser, please consider opening a pull
|
78
|
-
request to add support!
|
79
|
-
|
80
|
-
## Contributing
|
81
|
-
|
82
|
-
1. Fork it ( https://github.com/ianks/octodown/fork )
|
83
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
84
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
85
|
-
4. Run the test suite (`bundle exec rake`)
|
86
|
-
5. Push to the branch (`git push origin my-new-feature`)
|
87
|
-
6. Create a new Pull Request
|
data/Rakefile
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
require 'bundler/gem_tasks'
|
2
|
-
require 'open-uri'
|
3
|
-
require 'fileutils'
|
4
|
-
require 'tempfile'
|
5
|
-
require 'rspec/core/rake_task'
|
6
|
-
require 'rubocop/rake_task'
|
7
|
-
|
8
|
-
RuboCop::RakeTask.new
|
9
|
-
|
10
|
-
RSpec::Core::RakeTask.new :spec do |task|
|
11
|
-
task.rspec_opts = '--format documentation'
|
12
|
-
end
|
13
|
-
|
14
|
-
task :default => [:spec, :rubocop]
|
15
|
-
|
16
|
-
task :styles do
|
17
|
-
begin
|
18
|
-
FileUtils.mkdir 'tmp'
|
19
|
-
download_deps
|
20
|
-
compile_less
|
21
|
-
ensure
|
22
|
-
FileUtils.remove_dir 'tmp'
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
def download_deps
|
27
|
-
host = 'https://raw.githubusercontent.com/atom/'
|
28
|
-
|
29
|
-
deps = {
|
30
|
-
'markdown-preview' => 'markdown-preview/master/stylesheets/markdown-preview.less',
|
31
|
-
'syntax-variables' => 'template-syntax/master/stylesheets/syntax-variables.less',
|
32
|
-
'colors' => 'template-syntax/master/stylesheets/colors.less'
|
33
|
-
}
|
34
|
-
|
35
|
-
deps.each do |k,v|
|
36
|
-
File.open("tmp/#{k}.less", 'w') do |out_file|
|
37
|
-
open(host + v, 'r') do |in_file|
|
38
|
-
out_file << in_file.read
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
def compile_less
|
45
|
-
tmp = 'tmp/github.css'
|
46
|
-
out_file = 'assets/markdown-preview.css'
|
47
|
-
`lessc tmp/markdown-preview.less #{tmp}`
|
48
|
-
|
49
|
-
File.open out_file, 'w' do |file|
|
50
|
-
css = File.read(tmp).gsub /markdown-preview/, 'markdown-body'
|
51
|
-
file << css
|
52
|
-
end
|
53
|
-
end
|
data/octodown.gemspec
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'octodown/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = 'octodown'
|
8
|
-
spec.version = Octodown::VERSION
|
9
|
-
spec.authors = ['Ian Ker-Seymer']
|
10
|
-
spec.email = ['i.kerseymer@gmail.com']
|
11
|
-
spec.summary = 'Github markdown straight from your shell.'
|
12
|
-
spec.homepage = 'https://github.com/ianks/octodown'
|
13
|
-
spec.license = 'MIT'
|
14
|
-
|
15
|
-
spec.files = `git ls-files -z`.split("\x0")
|
16
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
-
spec.require_paths = ['lib']
|
19
|
-
|
20
|
-
spec.add_dependency 'github-markup', '~> 1.3.1'
|
21
|
-
spec.add_dependency 'github-linguist', '~> 4.2.5'
|
22
|
-
spec.add_dependency 'html-pipeline', '~> 1.11.0'
|
23
|
-
spec.add_dependency 'sanitize', '~> 3.1.0'
|
24
|
-
spec.add_dependency 'github-markdown', '~> 0.6.8'
|
25
|
-
spec.add_dependency 'gemoji', '~> 2.1.0'
|
26
|
-
spec.add_dependency 'pygments.rb', '~> 0.6.0'
|
27
|
-
|
28
|
-
spec.add_development_dependency 'rspec', '~> 3.1.0'
|
29
|
-
spec.add_development_dependency 'rubocop', '~> 0.28.0'
|
30
|
-
spec.add_development_dependency 'bundler', '~> 1.7'
|
31
|
-
spec.add_development_dependency 'rake', '~> 10.0'
|
32
|
-
end
|
data/spec/browser_spec.rb
DELETED
data/spec/dummy/test.md
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
Hello world!
|
2
|
-
============
|
3
|
-
![some-img](https://foo.com/bar.img)
|
4
|
-
![some-img](https://foo.com/bar.img)
|
5
|
-
|
6
|
-
You are now reading markdown. How lucky you are!
|
7
|
-
|
8
|
-
```ruby
|
9
|
-
def some_code()
|
10
|
-
puts 'Yeah, this is some code.'
|
11
|
-
end
|
12
|
-
```
|
13
|
-
|
14
|
-
[some-file](test.txt)
|
@@ -1,44 +0,0 @@
|
|
1
|
-
require 'tempfile'
|
2
|
-
|
3
|
-
describe Octodown::Renderer::GithubMarkdown do
|
4
|
-
let(:dummy_path) { File.join(File.dirname(__FILE__), 'dummy', 'test.md') }
|
5
|
-
let(:content) { File.read dummy_path }
|
6
|
-
let(:html) do
|
7
|
-
Octodown::Renderer::GithubMarkdown.new(content, 'tmp').to_html
|
8
|
-
end
|
9
|
-
|
10
|
-
it 'create HTML from markdown file' do
|
11
|
-
expect(html).to include '<h1>Hello world!</h1>'
|
12
|
-
expect(html).to include(
|
13
|
-
'<p>You are now reading markdown. How lucky you are!</p>'
|
14
|
-
)
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'highlights the code' do
|
18
|
-
expect(html).to include 'highlight-ruby'
|
19
|
-
end
|
20
|
-
|
21
|
-
describe 'when :gfm option is set' do
|
22
|
-
context 'true' do
|
23
|
-
it 'renders hard-wraps' do
|
24
|
-
options = { :gfm => true }
|
25
|
-
doc = Octodown::Renderer::GithubMarkdown.new(content, 'tmp', options)
|
26
|
-
expect(doc.to_html).to include '<br>'
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
context 'false' do
|
31
|
-
it 'does not render hard-wraps' do
|
32
|
-
options = { :gfm => false }
|
33
|
-
doc = Octodown::Renderer::GithubMarkdown.new(content, 'tmp', options)
|
34
|
-
expect(doc.to_html).to_not include '<br>'
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
describe 'local file linking' do
|
40
|
-
it 'includes the local file from correct location' do
|
41
|
-
expect(html).to include '<a href="tmp/test.txt">some-file</a>'
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
require 'tempfile'
|
2
|
-
|
3
|
-
describe Octodown::Renderer::GithubMarkdown do
|
4
|
-
subject { Octodown::Support::RelativeRootFilter.new(nil) }
|
5
|
-
|
6
|
-
# Testing private methods because Nokogirl is a black box
|
7
|
-
it 'detects an non-HTTP/HTTPS URI correctly' do
|
8
|
-
expect(subject.send(:http_uri?, 'assets/test.png')).to eq false
|
9
|
-
end
|
10
|
-
|
11
|
-
it 'detects HTTP/HTTPS URI correctly' do
|
12
|
-
expect(subject.send(:http_uri?, 'http://foo.com/assets/test.png'))
|
13
|
-
.to eq true
|
14
|
-
expect(subject.send(:http_uri?, 'https://foo.com/assets/test.png'))
|
15
|
-
.to eq true
|
16
|
-
end
|
17
|
-
|
18
|
-
it 'renders the relative root correctly' do
|
19
|
-
root = '/home/test'
|
20
|
-
src = 'dummy/test.md'
|
21
|
-
|
22
|
-
expect(subject.send(:relative_path_from_document_root, root, src)).to eq(
|
23
|
-
'/home/test/dummy/test.md'
|
24
|
-
)
|
25
|
-
end
|
26
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
require 'octodown'
|
2
|
-
|
3
|
-
RSpec.configure do |config|
|
4
|
-
config.expect_with :rspec do |expectations|
|
5
|
-
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
6
|
-
end
|
7
|
-
|
8
|
-
config.default_formatter = 'doc' if config.files_to_run.one?
|
9
|
-
config.order = :random
|
10
|
-
|
11
|
-
Kernel.srand config.seed
|
12
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
require 'tempfile'
|
2
|
-
|
3
|
-
describe Octodown::Renderer::HTML do
|
4
|
-
let(:dummy_path) { File.join(File.dirname(__FILE__), 'dummy', 'test.md') }
|
5
|
-
let(:options) { { style: 'github' } }
|
6
|
-
let(:html) do
|
7
|
-
Octodown::Renderer::GithubMarkdown.new(File.read(dummy_path), 'tmp').to_html
|
8
|
-
end
|
9
|
-
|
10
|
-
subject { Octodown::Renderer::HTML.new(html, options).render }
|
11
|
-
|
12
|
-
before { allow(Octodown).to receive(:root) { '.' } }
|
13
|
-
|
14
|
-
it 'includes HTML from markdown rendering phase' do
|
15
|
-
expect(subject).to include '<h1>Hello world!</h1>'
|
16
|
-
expect(subject).to include 'highlight-ruby'
|
17
|
-
expect(subject).to include(
|
18
|
-
'<p>You are now reading markdown. How lucky you are!</p>'
|
19
|
-
)
|
20
|
-
end
|
21
|
-
|
22
|
-
it 'sets the title' do
|
23
|
-
expect(subject).to include '<title>Octodown Preview</title>'
|
24
|
-
end
|
25
|
-
|
26
|
-
it 'injects Github CSS' do
|
27
|
-
css = File.read(File.join(Octodown.root, 'assets', 'github.css'))
|
28
|
-
expect(subject).to include css
|
29
|
-
end
|
30
|
-
end
|
data.tar.gz.sig
DELETED
metadata.gz.sig
DELETED
Binary file
|