html-pipeline 0.0.6 → 0.0.7

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.
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.0.7
4
+
5
+ * optionally require github-linguist chrislloyd #33
6
+
3
7
  ## 0.0.6
4
8
 
5
9
  * don't mutate markdown strings: jakedouglas #32
data/README.md CHANGED
@@ -50,7 +50,7 @@ pipeline = HTML::Pipeline.new [
50
50
  HTML::Pipeline::MarkdownFilter,
51
51
  HTML::Pipeline::SyntaxHighlightFilter
52
52
  ]
53
- result = pipeline.call <<CODE
53
+ result = pipeline.call <<-CODE
54
54
  This is *great*:
55
55
 
56
56
  ``` ruby
@@ -94,10 +94,22 @@ filter.call
94
94
  * `MarkdownFilter` - convert markdown to html
95
95
  * `PlainTextInputFilter` - html escape text and wrap the result in a div
96
96
  * `SanitizationFilter` - whitelist sanitize user markup
97
- * `SyntaxHighlightFilter` - code syntax highlighter with [linguist](https://github.com/github/linguist)
97
+ * `SyntaxHighlightFilter` - [code syntax highlighter](#syntax-highlighting)
98
98
  * `TextileFilter` - convert textile to html
99
99
  * `TableOfContentsFilter` - anchor headings with name attributes
100
100
 
101
+ ## Syntax highlighting
102
+
103
+ `SyntaxHighlightFilter` uses [github-linguist](https://github.com/github/linguist)
104
+ to detect and highlight languages. It isn't included as a dependency by default
105
+ because it's a large dependency and
106
+ [a hassle to build on heroku](https://github.com/jch/html-pipeline/issues/33).
107
+ To use the filter, add the following to your Gemfile:
108
+
109
+ ```ruby
110
+ gem 'github-linguist'
111
+ ```
112
+
101
113
  ## Examples
102
114
 
103
115
  We define different pipelines for different parts of our app. Here are a few
@@ -121,7 +133,7 @@ SimplePipeline = Pipeline.new [
121
133
  SyntaxHighlightFilter,
122
134
  EmojiFilter,
123
135
  AutolinkFilter
124
- ], context, {}
136
+ ], context
125
137
 
126
138
  # Pipeline used for user provided content on the web
127
139
  MarkdownPipeline = Pipeline.new [
@@ -133,24 +145,24 @@ MarkdownPipeline = Pipeline.new [
133
145
  MentionFilter,
134
146
  EmojiFilter,
135
147
  SyntaxHighlightFilter
136
- ], context.merge(:gfm => true), {} # enable github formatted markdown
148
+ ], context.merge(:gfm => true) # enable github formatted markdown
137
149
 
138
150
 
139
151
  # Define a pipeline based on another pipeline's filters
140
152
  NonGFMMarkdownPipeline = Pipeline.new(MarkdownPipeline.filters,
141
- context.merge(:gfm => false), {})
153
+ context.merge(:gfm => false))
142
154
 
143
155
  # Pipelines aren't limited to the web. You can use them for email
144
156
  # processing also.
145
157
  HtmlEmailPipeline = Pipeline.new [
146
158
  ImageMaxWidthFilter
147
- ], {}, {}
159
+ ], {}
148
160
 
149
161
  # Just emoji.
150
162
  EmojiPipeline = Pipeline.new [
151
163
  HTMLInputFilter,
152
164
  EmojiFilter
153
- ], context, {}
165
+ ], context
154
166
  ```
155
167
 
156
168
  ## Extending
@@ -19,8 +19,9 @@ Gem::Specification.new do |gem|
19
19
  gem.add_dependency "nokogiri", "~> 1.4"
20
20
  gem.add_dependency "github-markdown", "~> 0.5"
21
21
  gem.add_dependency "sanitize", "~> 2.0"
22
- gem.add_dependency "github-linguist", "~> 2.1"
23
22
  gem.add_dependency "rinku", "~> 1.7"
24
23
  gem.add_dependency "escape_utils", "~> 0.2"
25
24
  gem.add_dependency "activesupport", ">= 2"
25
+
26
+ gem.add_development_dependency "github-linguist", "~> 2.1"
26
27
  end
@@ -1,4 +1,9 @@
1
- require 'linguist'
1
+ begin
2
+ require 'linguist'
3
+ rescue LoadError
4
+ $stderr.puts "You need to install linguist before using the SyntaxHighlightFilter. See README.md for details"
5
+ exit 1
6
+ end
2
7
 
3
8
  module HTML
4
9
  class Pipeline
@@ -1,5 +1,5 @@
1
1
  module HTML
2
2
  class Pipeline
3
- VERSION = "0.0.6"
3
+ VERSION = "0.0.7"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: html-pipeline
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-12-11 00:00:00.000000000 Z
13
+ date: 2013-01-30 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: gemoji
@@ -76,22 +76,6 @@ dependencies:
76
76
  - - ~>
77
77
  - !ruby/object:Gem::Version
78
78
  version: '2.0'
79
- - !ruby/object:Gem::Dependency
80
- name: github-linguist
81
- requirement: !ruby/object:Gem::Requirement
82
- none: false
83
- requirements:
84
- - - ~>
85
- - !ruby/object:Gem::Version
86
- version: '2.1'
87
- type: :runtime
88
- prerelease: false
89
- version_requirements: !ruby/object:Gem::Requirement
90
- none: false
91
- requirements:
92
- - - ~>
93
- - !ruby/object:Gem::Version
94
- version: '2.1'
95
79
  - !ruby/object:Gem::Dependency
96
80
  name: rinku
97
81
  requirement: !ruby/object:Gem::Requirement
@@ -140,6 +124,22 @@ dependencies:
140
124
  - - ! '>='
141
125
  - !ruby/object:Gem::Version
142
126
  version: '2'
127
+ - !ruby/object:Gem::Dependency
128
+ name: github-linguist
129
+ requirement: !ruby/object:Gem::Requirement
130
+ none: false
131
+ requirements:
132
+ - - ~>
133
+ - !ruby/object:Gem::Version
134
+ version: '2.1'
135
+ type: :development
136
+ prerelease: false
137
+ version_requirements: !ruby/object:Gem::Requirement
138
+ none: false
139
+ requirements:
140
+ - - ~>
141
+ - !ruby/object:Gem::Version
142
+ version: '2.1'
143
143
  description: GitHub HTML processing filters and utilities
144
144
  email:
145
145
  - ryan@github.com
@@ -220,4 +220,3 @@ test_files:
220
220
  - test/html/pipeline/sanitization_filter_test.rb
221
221
  - test/html/pipeline/toc_filter_test.rb
222
222
  - test/test_helper.rb
223
- has_rdoc: