jekyll-gfm-admonitions 0.1.2 → 0.2.0
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.
- checksums.yaml +4 -4
- data/assets/admonitions.css +1 -1
- data/lib/jekyll-gfm-admonitions.rb +14 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f4d88903b4f39d857f537e963c51676d129aa64a1b01b1347384d450f1c715b
|
4
|
+
data.tar.gz: 27f1bb25919a5de02325aa0000fff47840ef0a96fdcccde1f55527cf4b1d2d7c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c6a301cf15df7bd44ed11138059799d73c494a092649c0b92bfe9c189c026b8642de86d52d1fc90151b0063f446f8fb56ec4ac625f2e59018a445400459377a
|
7
|
+
data.tar.gz: 90f9cd3ead495506ddc433b2b593286ec8ba1f6e8d3477d992b779b3f2d70d54f4e3b3f55e67a7099bb7ab73b141a84a276661d179e6c395de9e89024bdbc362
|
data/assets/admonitions.css
CHANGED
@@ -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
|
-
|
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
|
-
|
80
|
-
|
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
|
-
|
91
|
+
|
92
|
+
page.output += "<style>#{CSSminify.compress(css)}</style>"
|
83
93
|
end
|
84
94
|
end
|
85
95
|
end
|