jekyll-gfm-admonitions 0.1.2 → 0.2.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
  SHA256:
3
- metadata.gz: 219a16407153ff4afd7586cd7f06bd865db5eacbb11c2ccd42f4567777b8813c
4
- data.tar.gz: 9e72824ed765b818af835f074be64ba7786a2248d4df9b6f433c2c9aee949cf6
3
+ metadata.gz: 2bd3b14863c909fa009e741f378bff65b4727794fce307818a742e50859d233e
4
+ data.tar.gz: bcbe98766111c4a71e8f98f1ba8fe00d9c036754262d9e6bc227a3dc54a60c59
5
5
  SHA512:
6
- metadata.gz: d8c5bb02c6c4c8724233f44eaf8dc8ca6a1e20b402e68a7bf2433ca9bb74e429d6ca3d5df868c4769201e693fcb5261d01a5ae6bc9ec420f56b53e1a1a39b76d
7
- data.tar.gz: a17141f9008abb7a5aa289201677e99168f1932486c87d6e76d474920d82f5a79d950959a657a114665cff2645c0e306315f8e35902d08b9c284e8244cfbb46c
6
+ metadata.gz: 57df6efea88902eefe6de29525a290de68cb78165c9924d7d95f2f583c5812d9a676eb81570fa2649ec6201b04ac2eefbfaf9bb36e298548bb6de160555502bf
7
+ data.tar.gz: d6f84ec3048005512cb32cde7647bfc0c02ab500a1b2bd8a74605e2a6053c66384829ac4a60b5b1b9cfc777020aab048492b7203eff770480e15f96d1a676af0
@@ -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
@@ -72,14 +77,19 @@ module JekyllGFMAdmonitions
72
77
  "<div class='markdown-alert markdown-alert-#{type}'>
73
78
  <p class='markdown-alert-title'>#{icon} #{title}</p>
74
79
  <p>#{@markdown.convert(text)}</p>
75
- </div>"
80
+ </div>\n\n"
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.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robin De Schepper