octodown 1.8.4 → 1.8.5

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: 6d69e3ea20bb771e3543300392cfcd93740a51f7
4
- data.tar.gz: 30f21c0d5a4db0472a940e4b9ea978b6cf4c3143
3
+ metadata.gz: ff1e7e9d43e431f7f3813471077eae8640d1d1f2
4
+ data.tar.gz: 69c44221576a481c7d004ab8f532a0b345d5e172
5
5
  SHA512:
6
- metadata.gz: e0cbaafd0246b4936627001f3d3611f9fecae63d6cf7570e4ba5d9026d8109dacf7163badcc320b067bedfd1cb64fa3e60339deda1d0084d352e7acedfce66e9
7
- data.tar.gz: 39faf85924e565cc85a1eb7b65b7af0259ecb515a20616ba10f9f10288d8cf7d27f6442c2896d8adb46e1f1d38a8be77651b06840a39b4ced8dd84a04bdfdc35
6
+ metadata.gz: b7765a5761a6de9468e4f5fed28112cc59a4350891f51d97f2324bf4cba7b350697d492a90584217938afe8bc6f44271ba6109e3cb962f840586653356f5c449
7
+ data.tar.gz: a48bf8897478325d88fa4bbaac2c754a3210438e1060c572c6ae2e0e6a5289bb39bfca949c1c62b5182c9d604ae0b51a3cd5ba38b22685433e980c2480e8249a
@@ -1,6 +1,5 @@
1
1
  require 'rouge'
2
2
  require 'html/pipeline'
3
- require_relative './../../html/pipeline/syntax_hightlight_filter'
4
3
  require 'task_list/filter'
5
4
  require 'octodown/renderer/renderable'
6
5
 
@@ -45,7 +44,7 @@ module Octodown
45
44
  def pipeline
46
45
  Pipeline.new [
47
46
  Pipeline::MarkdownFilter,
48
- Pipeline::SyntaxHighlightFilterPatch,
47
+ Pipeline::SyntaxHighlightFilter,
49
48
  Support::RelativeRootFilter,
50
49
  Pipeline::ImageMaxWidthFilter,
51
50
  Pipeline::MentionFilter,
@@ -1,3 +1,3 @@
1
1
  module Octodown
2
- VERSION = '1.8.4'.freeze
2
+ VERSION = '1.8.5'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: octodown
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.4
4
+ version: 1.8.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ian Ker-Seymer
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 2.7.2
75
+ version: 2.8.0
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 2.7.2
82
+ version: 2.8.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: launchy
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -281,7 +281,6 @@ files:
281
281
  - assets/github.css
282
282
  - assets/highlight.css
283
283
  - bin/octodown
284
- - lib/html/pipeline/syntax_hightlight_filter.rb
285
284
  - lib/octodown.rb
286
285
  - lib/octodown/renderer/github_markdown.rb
287
286
  - lib/octodown/renderer/html.rb
@@ -1,43 +0,0 @@
1
- # Monkey patch until https://github.com/jch/html-pipeline/pull/295/files is merged
2
- module HTML
3
- class Pipeline
4
- # HTML Filter that syntax highlights code blocks wrapped
5
- # in <pre lang="...">.
6
- class SyntaxHighlightFilterPatch < Filter
7
- def initialize(*args)
8
- super(*args)
9
- @formatter = Rouge::Formatters::HTML.new
10
- end
11
-
12
- def call
13
- doc.search('pre').each do |node|
14
- default = context[:highlight] && context[:highlight].to_s
15
- next unless lang = node['lang'] || default
16
- next unless lexer = lexer_for(lang)
17
- text = node.inner_text
18
-
19
- html = highlight_with_timeout_handling(text, lang)
20
- next if html.nil?
21
-
22
- node.inner_html = html
23
- klass = node['class']
24
- scope = context[:scope] || "highlight-#{lang}"
25
- klass = [klass, scope].compact.join ' '
26
-
27
- node['class'] = klass
28
- end
29
- doc
30
- end
31
-
32
- def highlight_with_timeout_handling(text, lang)
33
- Rouge.highlight(text, lang, @formatter)
34
- rescue Timeout::Error => _
35
- nil
36
- end
37
-
38
- def lexer_for(lang)
39
- Rouge::Lexer.find(lang)
40
- end
41
- end
42
- end
43
- end