jekyll-callout 0.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: cae7be1da3b75b5c2fb8034baa6a7ea5ecf4e0abc398d698d8034f3be1bc2ade
4
+ data.tar.gz: 660d6ef03b54b3d7beeaa6fe4c3f83f2fa1db1eec8032cf343abdf1c4b3b2a35
5
+ SHA512:
6
+ metadata.gz: e24b16f5e099db766c4ccc2a8314d4b799845210f476664dda3bc2b84df319bbca1df2d44a5fa0ececcf7f9d7c673d581723618b9770eb15af2a0233ef7daada
7
+ data.tar.gz: ef0373bd49dc68b8ab121255b0c4fe346674e2b7f16e657c2e20c92df19b0d494c73619629fbef03fa927ac17d779e08ed7db53cf95a5549d26f656995150133
data/CHANGELOG.md ADDED
@@ -0,0 +1,11 @@
1
+ # Changelog
2
+
3
+ ## [0.1.0] - 2026-08-20
4
+
5
+ ### Added
6
+ - Initial release
7
+ - `{% callout TYPE %}...{% endcallout %}` Liquid block tag
8
+ - Supported types: `note`, `tip`, `warning`, `danger`, `info`
9
+ - Optional custom title: `{% callout warning "Before You Deploy" %}`
10
+ - Markdown rendering inside callout body via kramdown
11
+ - BEM-style output classes: `callout`, `callout--TYPE`, `callout__title`, `callout__body`
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Jason Chance
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,109 @@
1
+ # jekyll-callout
2
+
3
+ A Jekyll plugin that provides a `{% callout %}` Liquid block tag for styled callout and admonition blocks. Content inside the block renders as Markdown.
4
+
5
+ ## Installation
6
+
7
+ Add to your `Gemfile`:
8
+
9
+ ```ruby
10
+ gem "jekyll-callout", "~> 0.1"
11
+ ```
12
+
13
+ Add to your `_config.yml`:
14
+
15
+ ```yaml
16
+ plugins:
17
+ - jekyll-callout
18
+ ```
19
+
20
+ Then run:
21
+
22
+ ```
23
+ bundle install
24
+ ```
25
+
26
+ ## Usage
27
+
28
+ **Basic callout:**
29
+
30
+ ```liquid
31
+ {% callout note %}
32
+ This is a **note** with Markdown support.
33
+ {% endcallout %}
34
+ ```
35
+
36
+ **With a custom title:**
37
+
38
+ ```liquid
39
+ {% callout warning "Before You Deploy" %}
40
+ Make sure you've run the full test suite.
41
+ {% endcallout %}
42
+ ```
43
+
44
+ **Supported types:** `note`, `tip`, `warning`, `danger`, `info`
45
+
46
+ ```liquid
47
+ {% callout note %}...{% endcallout %}
48
+ {% callout tip %}...{% endcallout %}
49
+ {% callout warning %}...{% endcallout %}
50
+ {% callout danger %}...{% endcallout %}
51
+ {% callout info %}...{% endcallout %}
52
+ ```
53
+
54
+ Omitting the type defaults to `note`.
55
+
56
+ ## Output HTML
57
+
58
+ ```html
59
+ <div class="callout callout--warning">
60
+ <div class="callout__title">Warning</div>
61
+ <div class="callout__body">
62
+ <p>Make sure you've run the full test suite.</p>
63
+ </div>
64
+ </div>
65
+ ```
66
+
67
+ ## Default Titles
68
+
69
+ | Type | Default Title |
70
+ |---|---|
71
+ | `note` | Note |
72
+ | `tip` | Tip |
73
+ | `warning` | Warning |
74
+ | `danger` | Danger |
75
+ | `info` | Info |
76
+
77
+ ## Styling
78
+
79
+ The plugin outputs unstyled BEM-classed markup. Add your own CSS. Here's a minimal starting point:
80
+
81
+ ```css
82
+ .callout {
83
+ padding: 1rem 1.25rem;
84
+ border-left: 4px solid #ccc;
85
+ margin-bottom: 1.5rem;
86
+ background: #f9f9f9;
87
+ }
88
+
89
+ .callout--note { border-color: #5b8dee; background: #eef3fd; }
90
+ .callout--tip { border-color: #28a745; background: #eafaf1; }
91
+ .callout--warning { border-color: #ffc107; background: #fffbea; }
92
+ .callout--danger { border-color: #dc3545; background: #fdf2f2; }
93
+ .callout--info { border-color: #17a2b8; background: #e8f7f9; }
94
+
95
+ .callout__title {
96
+ font-weight: bold;
97
+ margin-bottom: 0.4rem;
98
+ }
99
+
100
+ .callout__body > *:last-child {
101
+ margin-bottom: 0;
102
+ }
103
+ ```
104
+
105
+ No styles are injected by the plugin — all visual design belongs in your site's CSS.
106
+
107
+ ## License
108
+
109
+ MIT — see [LICENSE.txt](LICENSE.txt).
@@ -0,0 +1,65 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "kramdown"
4
+ require "liquid"
5
+
6
+ module Jekyll
7
+ class CalloutBlock < Liquid::Block
8
+ VALID_TYPES = %w[note tip warning danger info].freeze
9
+
10
+ DEFAULT_TITLES = {
11
+ "note" => "Note",
12
+ "tip" => "Tip",
13
+ "warning" => "Warning",
14
+ "danger" => "Danger",
15
+ "info" => "Info"
16
+ }.freeze
17
+
18
+ def initialize(tag_name, markup, tokens)
19
+ super
20
+ @type, @title = parse_markup(markup.strip)
21
+ end
22
+
23
+ def render(context)
24
+ raw_content = super
25
+ rendered_body = Kramdown::Document.new(raw_content.strip).to_html.strip
26
+
27
+ title_html = if @title && !@title.empty?
28
+ " <div class=\"callout__title\">#{@title}</div>\n"
29
+ else
30
+ ""
31
+ end
32
+
33
+ <<~HTML.strip
34
+ <div class="callout callout--#{@type}">
35
+ #{title_html} <div class="callout__body">
36
+ #{rendered_body}
37
+ </div>
38
+ </div>
39
+ HTML
40
+ end
41
+
42
+ private
43
+
44
+ def parse_markup(markup)
45
+ # Match: type optionally followed by quoted title
46
+ # e.g. `warning` or `warning "Before You Deploy"` or `warning 'title'`
47
+ if (m = markup.match(/\A(\w+)(?:\s+"([^"]*)"|\s+'([^']*)')?\z/))
48
+ type = m[1].downcase
49
+ title = m[2] || m[3]
50
+
51
+ unless VALID_TYPES.include?(type)
52
+ warn "jekyll-callout: Unknown type '#{type}', falling back to 'note'"
53
+ type = "note"
54
+ end
55
+
56
+ title ||= DEFAULT_TITLES[type]
57
+ [type, title]
58
+ else
59
+ ["note", DEFAULT_TITLES["note"]]
60
+ end
61
+ end
62
+ end
63
+ end
64
+
65
+ Liquid::Template.register_tag("callout", Jekyll::CalloutBlock)
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "jekyll/callout_tag"
metadata ADDED
@@ -0,0 +1,80 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jekyll-callout
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Jason Chance
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 2026-08-20 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: jekyll
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - "~>"
17
+ - !ruby/object:Gem::Version
18
+ version: '4.0'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - "~>"
24
+ - !ruby/object:Gem::Version
25
+ version: '4.0'
26
+ - !ruby/object:Gem::Dependency
27
+ name: kramdown
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - "~>"
31
+ - !ruby/object:Gem::Version
32
+ version: '2.0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '2.0'
40
+ description: jekyll-callout provides a {% callout TYPE %} Liquid block tag that wraps
41
+ content in BEM-classed callout divs. Supports note, tip, warning, danger, and info
42
+ types. Content renders as Markdown.
43
+ email:
44
+ - jason@jasonchance.com
45
+ executables: []
46
+ extensions: []
47
+ extra_rdoc_files: []
48
+ files:
49
+ - CHANGELOG.md
50
+ - LICENSE.txt
51
+ - README.md
52
+ - lib/jekyll-callout.rb
53
+ - lib/jekyll/callout_tag.rb
54
+ homepage: https://jasonchance.com/projects/jekyll-callout/
55
+ licenses:
56
+ - MIT
57
+ metadata:
58
+ homepage_uri: https://jasonchance.com/projects/jekyll-callout/
59
+ source_code_uri: https://github.com/jchance/jekyll-callout
60
+ bug_tracker_uri: https://github.com/jchance/jekyll-callout/issues
61
+ changelog_uri: https://github.com/jchance/jekyll-callout/blob/main/CHANGELOG.md
62
+ rdoc_options: []
63
+ require_paths:
64
+ - lib
65
+ required_ruby_version: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '3.0'
70
+ required_rubygems_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ requirements: []
76
+ rubygems_version: 3.6.2
77
+ specification_version: 4
78
+ summary: A Jekyll plugin that provides a {% callout %} Liquid block tag for styled
79
+ callout/admonition blocks.
80
+ test_files: []