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 +4 -4
- data/README.md +19 -0
- data/lib/jekyll-gfm-admonitions.rb +7 -3
- 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: dc9f0ddc552ebba0992fcb8f72442d0287525178cb8fd28c4fff424f78c6de73
|
4
|
+
data.tar.gz: f34f7981609bec30f6b2f80d94ccd48e22ac04b61f24c79edda628d336de17ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
96
|
-
|
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
|
|