jekyll-gfm-admonitions 0.1.2 → 0.2.0

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
  SHA256:
3
- metadata.gz: 219a16407153ff4afd7586cd7f06bd865db5eacbb11c2ccd42f4567777b8813c
4
- data.tar.gz: 9e72824ed765b818af835f074be64ba7786a2248d4df9b6f433c2c9aee949cf6
3
+ metadata.gz: 7f4d88903b4f39d857f537e963c51676d129aa64a1b01b1347384d450f1c715b
4
+ data.tar.gz: 27f1bb25919a5de02325aa0000fff47840ef0a96fdcccde1f55527cf4b1d2d7c
5
5
  SHA512:
6
- metadata.gz: d8c5bb02c6c4c8724233f44eaf8dc8ca6a1e20b402e68a7bf2433ca9bb74e429d6ca3d5df868c4769201e693fcb5261d01a5ae6bc9ec420f56b53e1a1a39b76d
7
- data.tar.gz: a17141f9008abb7a5aa289201677e99168f1932486c87d6e76d474920d82f5a79d950959a657a114665cff2645c0e306315f8e35902d08b9c284e8244cfbb46c
6
+ metadata.gz: 8c6a301cf15df7bd44ed11138059799d73c494a092649c0b92bfe9c189c026b8642de86d52d1fc90151b0063f446f8fb56ec4ac625f2e59018a445400459377a
7
+ data.tar.gz: 90f9cd3ead495506ddc433b2b593286ec8ba1f6e8d3477d992b779b3f2d70d54f4e3b3f55e67a7099bb7ab73b141a84a276661d179e6c395de9e89024bdbc362
@@ -32,7 +32,7 @@
32
32
  border-left-color: #4493f8;
33
33
  }
34
34
 
35
- .markdown-body .markdown-alert.markdown-alert-note svg path {
35
+ .markdown-body .markdown-alert.markdown-alert-note .markdown-alert-title {
36
36
  color: #4493f8;
37
37
  }
38
38
 
@@ -23,6 +23,7 @@ module JekyllGFMAdmonitions
23
23
  # syntax with HTML markup that includes appropriate iconography and CSS styling.
24
24
  class GFMAdmonitionConverter < Jekyll::Generator
25
25
  safe true
26
+ @@admonition_pages = []
26
27
 
27
28
  def initialize(*args)
28
29
  super(*args)
@@ -57,10 +58,14 @@ module JekyllGFMAdmonitions
57
58
 
58
59
  return unless doc.content != original_content
59
60
 
60
- inject_css(doc)
61
+ @@admonition_pages << doc
61
62
  @converted += 1
62
63
  end
63
64
 
65
+ def self.admonition_pages
66
+ return @@admonition_pages
67
+ end
68
+
64
69
  def convert_admonitions(doc)
65
70
  doc.content.gsub!(/>\s*\[!(IMPORTANT|NOTE|WARNING|TIP|CAUTION)\]\s*\n((?:>.*\n?)*)/) do
66
71
  type = ::Regexp.last_match(1).downcase
@@ -75,11 +80,16 @@ module JekyllGFMAdmonitions
75
80
  </div>"
76
81
  end
77
82
  end
83
+ end
78
84
 
79
- def inject_css(doc)
80
- Jekyll.logger.debug 'GFMA:', "Appending admonition style to '#{doc.path}'."
85
+ Jekyll::Hooks.register :site, :post_render do |site|
86
+ Jekyll.logger.info 'GFMA:', "Injecting admonition CSS in #{GFMAdmonitionConverter.admonition_pages.length} page(s)."
87
+
88
+ for page in GFMAdmonitionConverter.admonition_pages do
89
+ Jekyll.logger.debug 'GFMA:', "Appending admonition style to '#{page.path}'."
81
90
  css = File.read(File.expand_path('../assets/admonitions.css', __dir__))
82
- doc.content += "<style>#{CSSminify.compress(css)}</style>"
91
+
92
+ page.output += "<style>#{CSSminify.compress(css)}</style>"
83
93
  end
84
94
  end
85
95
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-gfm-admonitions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robin De Schepper