github-markdown-preview 2.1.0 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8bed903b1a1fd75cbd36702278337c725310bb14
4
- data.tar.gz: b2ec291a7ecc75481648c09128a7ab0dc11ff86f
3
+ metadata.gz: ad9c33816ff2d373708a20be309da846564b3cb2
4
+ data.tar.gz: dd007aaea38a4a90ec3013dc1dee52d5c98d8a61
5
5
  SHA512:
6
- metadata.gz: e768067cde5cd2cbac67d5202133e7d88a48db4661ecab1987f96761a1c4f0d068330d5d95a75728920fc860bc58fc2546976e68ed1c5567a14b167dfa446f34
7
- data.tar.gz: 50a50c99c7bdd26bf35f41bba912e4bf907c2f58cf72ce827578d0a8137af409c1690cdedcd22522b273caa4e1559b50eaf7e03c40e38954513224663ed85331
6
+ metadata.gz: 69f3762c79ffd53bf00c1b196d3c10914ddea23939ee0a263f8d7c2e729108d3ec3438a848f21dafb30fe3a95615b2d8a3971b18984db7a63f6b2efdb74893b9
7
+ data.tar.gz: a25188c2bb8716ff97b8d606ecae9993282a7c2861126dbc8b77aacf8772a2edbe5750f9b6bcd36aa4e2003cc9c49adf8cc74dad7fa797c489c95d4fc27b1330
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## v2.1.1
4
+ * Specify UTF-8 for the preview (fixes [#20](https://github.com/dmarcotte/github-markdown-preview/issues/20))
5
+ * Inline the Github CSS in the preview to make it a stand-alone html file (fixes [#21](https://github.com/dmarcotte/github-markdown-preview/issues/21))
6
+
3
7
  ## v2.1.0
4
8
  * Add option `:preview_file` for specifying a custom preview file
5
9
  * Refactor so the filters and context used to configure html-pipeline can be easily overriden/monkey-patched
@@ -156,9 +156,11 @@ module GithubMarkdownPreview
156
156
  def wrap_preview(preview_html)
157
157
  output_file_content =<<CONTENT
158
158
  <head>
159
- <link rel=stylesheet type=text/css href="#{Resources.expand_path(File.join('css','github.css'))}">
160
- <link rel=stylesheet type=text/css href="#{Resources.expand_path(File.join('css','github2.css'))}">
159
+ <meta charset="utf-8">
161
160
  <style type="text/css">
161
+ #{IO.read(Resources.expand_path(File.join('css','github.css')))}
162
+ #{IO.read(Resources.expand_path(File.join('css','github2.css')))}
163
+
162
164
  html, .markdown-body {
163
165
  overflow: inherit;
164
166
  }
@@ -1,3 +1,3 @@
1
1
  module GithubMarkdownPreview
2
- VERSION = '2.1.0'
2
+ VERSION = '2.1.1'
3
3
  end
data/readme.md CHANGED
@@ -1,4 +1,5 @@
1
- # Local Github Markdown Preview [![Build Status](https://secure.travis-ci.org/dmarcotte/github-markdown-preview.png)](http://travis-ci.org/dmarcotte/github-markdown-preview)
1
+ # Local Github Markdown Preview
2
+ [![Build Status](https://travis-ci.org/dmarcotte/github-markdown-preview.png?branch=master)](https://travis-ci.org/dmarcotte/github-markdown-preview)
2
3
 
3
4
  Use your favorite editor plus the usual edit/refresh cycle to quickly write and polish your markdown for Github.
4
5
 
@@ -47,7 +47,7 @@ class TestHtmlPreview < Minitest::Test
47
47
  def test_create_preview_on_init
48
48
  write(@source_file_path, '## foo')
49
49
  markdown_preview = @ghp.new( @source_file_path )
50
- assert_match /.*<h2>foo<\/h2>.*/,
50
+ assert_equal markdown_preview.wrap_preview('<h2>foo</h2>'),
51
51
  read(markdown_preview.preview_file),
52
52
  'Preview should be correct on initialization'
53
53
  end
@@ -55,7 +55,7 @@ class TestHtmlPreview < Minitest::Test
55
55
  def test_word_immediately_after_hash
56
56
  write(@source_file_path, '#foo')
57
57
  markdown_preview = @ghp.new( @source_file_path )
58
- assert_match /.*<h1>foo<\/h1>.*/,
58
+ assert_equal markdown_preview.wrap_preview('<h1>foo</h1>'),
59
59
  read(markdown_preview.preview_file),
60
60
  'Preview should render #foo as a header'
61
61
  end
@@ -63,7 +63,7 @@ class TestHtmlPreview < Minitest::Test
63
63
  def test_comment_mode_word_immediately_after_hash
64
64
  write(@source_file_path, '#foo')
65
65
  markdown_preview = @ghp.new( @source_file_path, { :comment_mode => true } )
66
- assert_match /.*#foo*/,
66
+ assert_equal markdown_preview.wrap_preview('<p>#foo</p>'),
67
67
  read(markdown_preview.preview_file),
68
68
  'Preview should render #foo directly'
69
69
  end
@@ -71,7 +71,7 @@ class TestHtmlPreview < Minitest::Test
71
71
  def test_default_mode_ignores_task_lists
72
72
  write(@source_file_path, '- [ ] task')
73
73
  markdown_preview = @ghp.new( @source_file_path)
74
- assert_match markdown_preview.wrap_preview("<ul>\n<li>[ ] task</li>\n</ul>"),
74
+ assert_equal markdown_preview.wrap_preview("<ul>\n<li>[ ] task</li>\n</ul>"),
75
75
  read(markdown_preview.preview_file),
76
76
  'Should not contain a task list item in default mode'
77
77
  end
@@ -79,7 +79,7 @@ class TestHtmlPreview < Minitest::Test
79
79
  def test_comment_mode_task_lists
80
80
  write(@source_file_path, '- [ ] task')
81
81
  markdown_preview = @ghp.new( @source_file_path, { :comment_mode => true } )
82
- assert_match markdown_preview.wrap_preview("<ul class=\"task-list\">\n<li class=\"task-list-item\">\n<input class=\"task-list-item-checkbox\" type=\"checkbox\"> task</li>\n</ul>"),
82
+ assert_equal markdown_preview.wrap_preview("<ul class=\"task-list\">\n<li class=\"task-list-item\">\n<input class=\"task-list-item-checkbox\" type=\"checkbox\"> task</li>\n</ul>"),
83
83
  read(markdown_preview.preview_file),
84
84
  'Should contain a task list item in comment mode'
85
85
  end
@@ -87,7 +87,7 @@ class TestHtmlPreview < Minitest::Test
87
87
  def test_newlines_ignored
88
88
  write(@source_file_path, "foo\nbar")
89
89
  markdown_preview = @ghp.new( @source_file_path )
90
- assert_match /.*foo\nbar*/,
90
+ assert_equal markdown_preview.wrap_preview("<p>foo\nbar</p>"),
91
91
  read(markdown_preview.preview_file),
92
92
  'Should not contain <br> for newline'
93
93
  end
@@ -95,7 +95,7 @@ class TestHtmlPreview < Minitest::Test
95
95
  def test_comment_mode_newlines_respected
96
96
  write(@source_file_path, "foo\nbar")
97
97
  markdown_preview = @ghp.new( @source_file_path, { :comment_mode => true } )
98
- assert_match markdown_preview.wrap_preview("<p>foo<br>\nbar</p>"),
98
+ assert_equal markdown_preview.wrap_preview("<p>foo<br>\nbar</p>"),
99
99
  read(markdown_preview.preview_file),
100
100
  'Should insert <br> for newline in comment mode'
101
101
  end
@@ -103,7 +103,7 @@ class TestHtmlPreview < Minitest::Test
103
103
  def test_at_mentions_not_linked
104
104
  write(@source_file_path, "@username")
105
105
  markdown_preview = @ghp.new( @source_file_path )
106
- assert_match markdown_preview.wrap_preview("<p>@username</p>"),
106
+ assert_equal markdown_preview.wrap_preview("<p>@username</p>"),
107
107
  read(markdown_preview.preview_file),
108
108
  '@mentions should not be linked'
109
109
  end
@@ -111,7 +111,7 @@ class TestHtmlPreview < Minitest::Test
111
111
  def test_comment_mode_at_mentions_linked
112
112
  write(@source_file_path, "@username")
113
113
  markdown_preview = @ghp.new( @source_file_path, { :comment_mode => true } )
114
- assert_match markdown_preview.wrap_preview('<p><a href="https://github.com/username" class="user-mention">@username</a></p>'),
114
+ assert_equal markdown_preview.wrap_preview('<p><a href="https://github.com/username" class="user-mention">@username</a></p>'),
115
115
  read(markdown_preview.preview_file),
116
116
  '@mentions should create links'
117
117
  end
@@ -119,7 +119,7 @@ class TestHtmlPreview < Minitest::Test
119
119
  def test_wrapper_markup_included
120
120
  write(@source_file_path, '## foo')
121
121
  markdown_preview = @ghp.new( @source_file_path )
122
- assert_equal markdown_preview.wrap_preview("<h2>foo<\/h2>"),
122
+ assert_equal markdown_preview.wrap_preview("<h2>foo</h2>"),
123
123
  read(markdown_preview.preview_file),
124
124
  'Wrapper markup should be in preview file'
125
125
  end
@@ -146,12 +146,13 @@ class TestHtmlPreview < Minitest::Test
146
146
  def test_update_preview
147
147
  write(@source_file_path, '## foo')
148
148
  markdown_preview = @ghp.new( @source_file_path )
149
- assert_match /.*<h2>foo<\/h2>.*/, read(markdown_preview.preview_file),
149
+ assert_equal markdown_preview.wrap_preview('<h2>foo</h2>'),
150
+ read(markdown_preview.preview_file),
150
151
  'Preview should be initially rendered correctly'
151
152
 
152
153
  write(@source_file_path, '## foo bar')
153
154
  markdown_preview.update
154
- assert_match /.*<h2>foo bar<\/h2>.*/,
155
+ assert_equal markdown_preview.wrap_preview('<h2>foo bar</h2>'),
155
156
  read(markdown_preview.preview_file),
156
157
  'Preview should be updated correctly'
157
158
  end
@@ -203,7 +204,7 @@ class TestHtmlPreview < Minitest::Test
203
204
 
204
205
  markdown_preview.end_watch
205
206
 
206
- assert_match /.*<h2>foo bar<\/h2>.*/,
207
+ assert_equal markdown_preview.wrap_preview('<h2>foo bar</h2>'),
207
208
  read(markdown_preview.preview_file)
208
209
  'Preview file should be updated correctly by file watcher'
209
210
  end
@@ -229,7 +230,7 @@ class TestHtmlPreview < Minitest::Test
229
230
  markdown_preview = @ghp.new( @source_file_path, { :preview_file => custom_preview} )
230
231
  assert_equal custom_preview,
231
232
  markdown_preview.preview_file
232
- assert_match /.*<h2>foo<\/h2>.*/,
233
+ assert_equal markdown_preview.wrap_preview('<h2>foo</h2>'),
233
234
  read(markdown_preview.preview_file),
234
235
  'Should write to the custom preview file'
235
236
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: github-markdown-preview
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Marcotte
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-07 00:00:00.000000000 Z
11
+ date: 2014-02-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: listen