ghpreview 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -8,6 +8,11 @@ automatically refreshes every time you save your source.
8
8
  While README files are the most common use case, `ghpreview` works with any
9
9
  Markdown file.
10
10
 
11
+ ## Prerequisites
12
+
13
+ You'll need the icu library. If you're on a Mac, `brew install icu4c` will do
14
+ the trick.
15
+
11
16
  ## Installation
12
17
 
13
18
  ```bash
@@ -40,7 +45,7 @@ This is especially notable with fenced code blocks and syntax highlighting.
40
45
 
41
46
  `ghpreview` is an accurate preview because it uses Github's own [HTML
42
47
  processing filters](https://github.com/jch/html-pipeline) to generate the HTML,
43
- and Github's own stylesheets to style it.
48
+ and Github's own stylesheets to style it :octocat:
44
49
 
45
50
  ## Contributing
46
51
 
@@ -35,6 +35,7 @@ module GHPreview
35
35
  html = markdown_to_html
36
36
  html = wrap_content_with_full_document(html)
37
37
  File.open(HTML_FILEPATH, 'w') { |f| f << html }
38
+
38
39
  if RUBY_PLATFORM =~ /linux/
39
40
  command = 'xdg-open'
40
41
  else
@@ -47,16 +48,21 @@ module GHPreview
47
48
 
48
49
  def markdown_to_html
49
50
  markdown = File.read(@md_filepath)
51
+
52
+ context = {
53
+ asset_root: "http://assets.github.com/images/icons/",
54
+ gfm: false
55
+ }
56
+
50
57
  pipeline = HTML::Pipeline.new([
51
58
  HTML::Pipeline::MarkdownFilter,
52
59
  HTML::Pipeline::SanitizationFilter,
53
- HTML::Pipeline::CamoFilter,
54
60
  HTML::Pipeline::ImageMaxWidthFilter,
55
61
  HTML::Pipeline::HttpsFilter,
56
62
  HTML::Pipeline::MentionFilter,
57
63
  HTML::Pipeline::EmojiFilter,
58
64
  HTML::Pipeline::SyntaxHighlightFilter
59
- ], gfm: false)
65
+ ], context)
60
66
  result = pipeline.call(markdown)[:output].to_s
61
67
  end
62
68
 
@@ -68,7 +74,9 @@ module GHPreview
68
74
 
69
75
  raw_template = File.read(RAW_TEMPLATE_FILEPATH)
70
76
  styled_template = ERB.new(raw_template).result(binding)
71
- File.write(STYLED_TEMPLATE_FILEPATH, styled_template)
77
+ File.open(STYLED_TEMPLATE_FILEPATH, 'w') do |f|
78
+ f.write(styled_template)
79
+ end
72
80
  end
73
81
  end
74
82
 
@@ -1,3 +1,3 @@
1
1
  module GHPreview
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ghpreview
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-30 00:00:00.000000000 Z
12
+ date: 2012-12-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: listen
@@ -119,3 +119,4 @@ signing_key:
119
119
  specification_version: 3
120
120
  summary: Command line utility for previewing Markdown files with Github styling
121
121
  test_files: []
122
+ has_rdoc: