jekyll-gfm-admonitions 1.0.4 → 1.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 55602a9eb6c0421b49d053f7c5d632d3688d13fe4b200c9b46df7e28fa13082b
4
- data.tar.gz: 9bac7b962095054d91543ff318dd525f1b171a6998bcd880d58b64d991a6b1a8
3
+ metadata.gz: dc9f0ddc552ebba0992fcb8f72442d0287525178cb8fd28c4fff424f78c6de73
4
+ data.tar.gz: f34f7981609bec30f6b2f80d94ccd48e22ac04b61f24c79edda628d336de17ef
5
5
  SHA512:
6
- metadata.gz: 17d54f579fa4ff3f59c4ef4473f664c044207f86ada2710e46fba9afa79aa181b0df9ef3abdda9c5a4eb42a018fd55ff3e3448bf56ca60b70eec553abda728e6
7
- data.tar.gz: 3fb3cd143db748991579039b9d0704dc1490e080cb49c02132b308fe68553f370f5344fed0d91f2f914bb85ea7750609e2a1786066ed0f3008e4f138fc2a8d2e
6
+ metadata.gz: aaa925808c069eba043e9dc6de87f5c1eb48b09bb14c5844de5a14e2b5042e5b43d2fbc91d25c247700da098838ca58abb66f5b5797baaeac3d001538b489f13
7
+ data.tar.gz: 12542bc582af05684a1cac7e6c70dc9e3156904b941b8f5d4f3866e655da657a9ec332d2810a5eee639f74198b52af6643b639371fa47bfa15f7c8c9c3e8a775
data/README.md CHANGED
@@ -4,6 +4,13 @@ A Jekyll plugin to render GitHub-flavored admonitions in your Jekyll sites.
4
4
  This plugin allows you to use GitHub-flavored markdown syntax to create stylish admonition
5
5
  blocks for notes, warnings, tips, cautions, and important messages.
6
6
 
7
+ ## Features
8
+
9
+ * Admonitions
10
+ * Admonition titles
11
+ * Jekyll support
12
+ * GitHub Pages support
13
+
7
14
  ## Supported Admonitions
8
15
 
9
16
  The following admonitions are supported:
@@ -53,6 +60,18 @@ To use admonitions in your markdown files, simply add the following syntax:
53
60
  > [!CAUTION]
54
61
  > Negative potential consequences of an action.
55
62
 
63
+ #### Custom titles
64
+
65
+ Custom admonition titles are supported:
66
+
67
+ > [!TIP] My own title
68
+ > Fancy!
69
+
70
+ > [!NOTE]
71
+ > GFM itself does not support this syntax, so this will only wokr in your
72
+ > build output, but not on your GitHub rendered READMEs etc.
73
+
74
+
56
75
  ## Installation
57
76
 
58
77
  To install the plugin, add it to your Jekyll project's `Gemfile`:
@@ -90,10 +90,14 @@ module JekyllGFMAdmonitions
90
90
  end
91
91
 
92
92
  def convert_admonitions(doc)
93
- doc.content.gsub!(/>\s*\[!(IMPORTANT|NOTE|WARNING|TIP|CAUTION)\]\s*\n((?:>.*\n?)*)/) do
93
+ doc.content.gsub!(/>\s*\[!(IMPORTANT|NOTE|WARNING|TIP|CAUTION)\]\s*(.*)\s*\n((?:>.*\n?)*)/) do
94
94
  type = ::Regexp.last_match(1).downcase
95
- title = type.capitalize
96
- text = ::Regexp.last_match(2).gsub(/^>\s*/, '').strip
95
+ if ::Regexp.last_match(2).length > 0
96
+ title = ::Regexp.last_match(2)
97
+ else
98
+ title = type.capitalize
99
+ end
100
+ text = ::Regexp.last_match(3).gsub(/^>\s*/, '').strip
97
101
  icon = Octicons::Octicon.new(ADMONITION_ICONS[type]).to_svg
98
102
  Jekyll.logger.debug 'GFMA:', "Converting #{type} admonition."
99
103
 
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: 1.0.4
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robin De Schepper