jekyll-webawesome 0.14.0 → 0.16.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: 245ba4dad039172f52286841d437c0949cc10e0769324b192707589dbde2ac84
4
- data.tar.gz: 2035f8185bdf9da3b664d88c22351842142098fcc185af977a091bf6cea79c65
3
+ metadata.gz: adeebc3995bb614e0c221f9424cf22200eb70c062f8c4d5500bc8e92f935b0f6
4
+ data.tar.gz: a49c3aec2dc3159b4f03854aa2646fd3410cbae910e4c060e0207f45fbe29a2d
5
5
  SHA512:
6
- metadata.gz: fd137a5495ce01aa36194f528873758706b9925d491a564e3b86e0080481ea1499bbd7d8380e844a80b791810893aa8f77603353fec76b0cc73e254061d214d8
7
- data.tar.gz: dc4318b0450ef4fd151b7ef5cdec10d1c72b2c63361a64eb39892a17685763355b9d283b06d562773fb3efd05a96172ad2fd326504e1e3865b52d9947c6e5de5
6
+ metadata.gz: 0eb010999a613a1cd9e58e29a852f6c479ce0d4e11c91e371f6406b2ee66ae4cf1d6a2d739ac0ffb6a85eb63dd7453d1e4b6798b165d5453bccec55a68b3798f
7
+ data.tar.gz: 15cbd4e4f50c414ac5ce11f9f34da33b6afae15edeb4a50ed9b894ef76215d4354dd1cc0b80847c954c137374aeeb9f0816146a6c4d709fa2b163d29f5a04ae4
data/CHANGELOG.md CHANGED
@@ -4,6 +4,29 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
6
6
 
7
+ ## [0.16.0] - 2026-05-05
8
+
9
+ ### Changed
10
+
11
+ - Internal: code block protection (replacing fenced code blocks with placeholders before Markawesome transforms run, so `:::info`/`^^^`/`@@@` examples inside fenced code stay intact) is now delegated to `Markawesome::CodeBlockProtector` instead of being implemented locally. The Jekyll-specific `{% highlight %}` substitution at priority 15 stays in this gem. No behavior change for Jekyll users.
12
+ - Updated `markawesome` dependency to `~> 0.10`. The 0.10.0 release adds `Markawesome::PlainMarkdownRenderer` (an alternate renderer that emits clean GFM instead of HTML) and exposes `Markawesome::CodeBlockProtector` as a public helper.
13
+
14
+ ## [0.15.0] - 2026-03-12
15
+
16
+ ### Added
17
+
18
+ - **Inline popover syntax** via markawesome 0.9.0: `&&&trigger text >>> popover content&&&` for use within sentences
19
+ - Always renders as link-styled trigger (underlined text)
20
+ - Supports all parameters: placement, `without-arrow`, `distance:N`
21
+ - Plain text content (HTML-escaped, no markdown processing)
22
+ - Multiple inline popovers supported on the same line
23
+ - Inline popover examples added to example site
24
+ - Updated README with inline popover documentation
25
+
26
+ ### Changed
27
+
28
+ - Updated `markawesome` dependency to `~> 0.9`
29
+
7
30
  ## [0.14.0] - 2026-03-12
8
31
 
9
32
  ### Changed
data/README.md CHANGED
@@ -1180,6 +1180,20 @@ Multiple paragraphs work too.
1180
1180
  &&&
1181
1181
  ```
1182
1182
 
1183
+ #### Inline Syntax
1184
+
1185
+ Popovers can be used inline within a sentence using `&&&trigger text >>> popover content&&&` on a single line. Inline popovers always render as link-styled triggers:
1186
+
1187
+ ```markdown
1188
+ Send invoices via &&&Peppol >>> A standardized e-invoicing network&&& to your customers.
1189
+
1190
+ Learn about &&&bottom API keys >>> API keys authenticate your requests&&& in the docs.
1191
+
1192
+ Check &&&right without-arrow distance:5 validation >>> Invoices are validated against business rules&&& before submitting.
1193
+ ```
1194
+
1195
+ Parameters (placement, `without-arrow`, `distance:N`) come before the trigger text. Inline popover content is plain text (use block syntax for rich markdown content).
1196
+
1183
1197
  #### Alternative Syntax
1184
1198
 
1185
1199
  You can also use the explicit `:::wa-popover` syntax:
@@ -1197,7 +1211,7 @@ Popover content using the alternative syntax.
1197
1211
  | Option | Values | Default | Description |
1198
1212
  |--------|--------|---------|-------------|
1199
1213
  | `placement` | `top`, `bottom`, `left`, `right` | `top` | Where the popover appears |
1200
- | `link` | keyword | off | Renders trigger as underlined text instead of button |
1214
+ | `link` | keyword | off (always on for inline) | Renders trigger as underlined text instead of button |
1201
1215
  | `without-arrow` | keyword | off | Hides the popover arrow |
1202
1216
  | `distance:N` | number (pixels) | (default) | Distance between trigger and popover |
1203
1217
 
@@ -33,7 +33,7 @@ Gem::Specification.new do |spec|
33
33
  spec.require_paths = ['lib']
34
34
 
35
35
  spec.add_dependency 'jekyll', '>= 3.7', '< 5.0'
36
- spec.add_dependency 'markawesome', '~> 0.7'
36
+ spec.add_dependency 'markawesome', '~> 0.10'
37
37
 
38
38
  spec.add_development_dependency 'bundler', '~> 2.0'
39
39
  spec.add_development_dependency 'rake', '~> 13.0'
@@ -1,71 +1,61 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'markawesome/code_block_protector'
4
+
3
5
  module Jekyll
4
6
  module WebAwesome
5
- # Transforms markdown code blocks to Jekyll highlight syntax
7
+ # Protects markdown fenced code blocks before Markawesome transforms
8
+ # run, and substitutes them with Jekyll `{% highlight %}` tags after,
9
+ # so code examples containing `:::`/`^^^`/`@@@` survive intact and
10
+ # language-tagged blocks still render with Jekyll's syntax highlighter.
11
+ #
12
+ # Protection/restore is delegated to Markawesome::CodeBlockProtector;
13
+ # the `{% highlight %}` substitution at priority 15 is Jekyll-specific
14
+ # and stays here.
6
15
  module CodeBlockTransformer
7
- CODE_BLOCK_PATTERN = /```([a-zA-Z0-9.+#_-]+)?(\n.*?)```/m
16
+ CODE_BLOCK_PATTERN = Markawesome::CodeBlockProtector::CODE_BLOCK_PATTERN
8
17
 
9
- # Class variable to store protected blocks across hook calls
10
- @@protected_blocks = {}
18
+ @protected_blocks = {}
11
19
 
12
20
  class << self
21
+ attr_reader :protected_blocks
22
+
13
23
  def clear_protected_blocks
14
- @@protected_blocks.clear
24
+ @protected_blocks.clear
15
25
  end
16
26
 
17
27
  # Check if pages transformation is enabled
18
28
  def transform_pages_enabled?(site)
19
- # Check plugin configuration first
20
29
  return Jekyll::WebAwesome.configuration.transform_pages if Jekyll::WebAwesome.configuration
21
-
22
- # Check site config
23
30
  return site.config.dig('webawesome', 'transform_pages') if site.config.dig('webawesome', 'transform_pages') != nil
24
31
 
25
- # Default to true
26
32
  true
27
33
  end
28
34
 
29
35
  # Check if documents transformation is enabled
30
36
  def transform_documents_enabled?(site)
31
- # Check plugin configuration first
32
37
  return Jekyll::WebAwesome.configuration.transform_documents if Jekyll::WebAwesome.configuration
33
-
34
- # Check site config
35
38
  return site.config.dig('webawesome', 'transform_documents') if site.config.dig('webawesome', 'transform_documents') != nil
36
39
 
37
- # Default to true
38
40
  true
39
41
  end
40
42
 
41
- # Check if a code block contains WebAwesome syntax that should be preserved
42
- def contains_webawesome_syntax?(content)
43
- # Check for WebAwesome patterns
44
- callout_pattern = /^:::(info|success|neutral|warning|danger)/m
45
- details_pattern = /^\^\^\^/m
46
- tabs_pattern = /^\+{6}/m
47
-
48
- content.match?(callout_pattern) || content.match?(details_pattern) || content.match?(tabs_pattern)
49
- end
50
-
51
- # Protect all code blocks by converting them to placeholders
52
- # This prevents markdown processing from corrupting code blocks inside custom elements
43
+ # Protect all code blocks by converting them to placeholders via
44
+ # Markawesome::CodeBlockProtector. The resulting token map is
45
+ # merged into @protected_blocks so per-page placeholders survive
46
+ # across the pre_render priority chain (50 → 15 → 10).
53
47
  def protect_all_code_blocks(content)
54
- counter = @@protected_blocks.size
55
-
56
- content.gsub(CODE_BLOCK_PATTERN) do |match|
57
- placeholder = "<!--PROTECTED_CODE_BLOCK_#{counter}-->"
58
- @@protected_blocks[placeholder] = match
59
- counter += 1
60
- placeholder
61
- end
48
+ protected_content, tokens = Markawesome::CodeBlockProtector.protect(content)
49
+ @protected_blocks.merge!(tokens)
50
+ protected_content
62
51
  end
63
52
 
64
- # Transform code blocks from markdown syntax to Jekyll highlight tags
65
- # This should be called AFTER WebAwesome transformers have processed the content
53
+ # Rewrite each protected fenced block to a Jekyll `{% highlight %}`
54
+ # tag, except for blocks without a language or with `plain` — those
55
+ # are restored verbatim. Called at priority 15, i.e. after
56
+ # Markawesome transformers but before restore.
66
57
  def transform_code_blocks(content)
67
- # Transform code blocks that were previously protected
68
- @@protected_blocks.transform_values! do |match|
58
+ @protected_blocks.transform_values! do |match|
69
59
  if match =~ CODE_BLOCK_PATTERN
70
60
  language = Regexp.last_match(1)
71
61
  code_content = Regexp.last_match(2).strip
@@ -73,7 +63,7 @@ module Jekyll
73
63
  if language && language.downcase != 'plain'
74
64
  "{% highlight #{language} %}\n#{code_content}\n{% endhighlight %}"
75
65
  else
76
- match # Return original block if no language or 'plain'
66
+ match
77
67
  end
78
68
  else
79
69
  match
@@ -82,12 +72,14 @@ module Jekyll
82
72
  content
83
73
  end
84
74
 
85
- # Restore protected WebAwesome example blocks after WaElementTransformer processing
75
+ # Restore protected code blocks using Markawesome::CodeBlockProtector,
76
+ # then clear the per-page token map so the next page starts fresh.
77
+ # CodeBlockProtector.protect always restarts its counter at 0, so
78
+ # clearing between pages prevents placeholder-id collisions.
86
79
  def restore_protected_blocks(content)
87
- @@protected_blocks.each do |placeholder, original_block|
88
- content = content.gsub(placeholder, original_block)
89
- end
90
- content
80
+ restored = Markawesome::CodeBlockProtector.restore(content, @protected_blocks)
81
+ @protected_blocks.clear
82
+ restored
91
83
  end
92
84
 
93
85
  def process(content)
@@ -95,15 +87,11 @@ module Jekyll
95
87
  end
96
88
  end
97
89
 
98
- # Register hooks directly in the transformer module
99
- # Wrapped in conditional to prevent errors when Jekyll::Hooks is not fully loaded
100
90
  if defined?(Jekyll::Hooks)
101
- # Clear protected blocks at start of build
102
91
  Jekyll::Hooks.register :site, :pre_render do |_site|
103
92
  CodeBlockTransformer.clear_protected_blocks
104
93
  end
105
94
 
106
- # STEP 1: Protect all code blocks BEFORE any transformations (highest priority)
107
95
  Jekyll::Hooks.register :documents, :pre_render, priority: 50 do |document|
108
96
  next unless document.relative_path =~ /.*\.md$/i
109
97
  next unless CodeBlockTransformer.transform_documents_enabled?(document.site)
@@ -120,8 +108,6 @@ module Jekyll
120
108
  page.content = CodeBlockTransformer.protect_all_code_blocks(page.content)
121
109
  end
122
110
 
123
- # STEP 2: Transform protected code blocks to Jekyll highlight syntax
124
- # This happens AFTER WebAwesome transformers (priority 20) but BEFORE restoration
125
111
  Jekyll::Hooks.register :documents, :pre_render, priority: 15 do |document|
126
112
  next unless document.relative_path =~ /.*\.md$/i
127
113
  next unless CodeBlockTransformer.transform_documents_enabled?(document.site)
@@ -138,7 +124,6 @@ module Jekyll
138
124
  page.content = CodeBlockTransformer.transform_code_blocks(page.content)
139
125
  end
140
126
 
141
- # STEP 3: Restore protected blocks after transformation (lowest priority)
142
127
  Jekyll::Hooks.register :documents, :pre_render, priority: 10 do |document|
143
128
  next unless document.relative_path =~ /.*\.md$/i
144
129
  next unless CodeBlockTransformer.transform_documents_enabled?(document.site)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  module WebAwesome
5
- VERSION = '0.14.0'
5
+ VERSION = '0.16.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-webawesome
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.0
4
+ version: 0.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Janne Waren
@@ -35,14 +35,14 @@ dependencies:
35
35
  requirements:
36
36
  - - "~>"
37
37
  - !ruby/object:Gem::Version
38
- version: '0.7'
38
+ version: '0.10'
39
39
  type: :runtime
40
40
  prerelease: false
41
41
  version_requirements: !ruby/object:Gem::Requirement
42
42
  requirements:
43
43
  - - "~>"
44
44
  - !ruby/object:Gem::Version
45
- version: '0.7'
45
+ version: '0.10'
46
46
  - !ruby/object:Gem::Dependency
47
47
  name: bundler
48
48
  requirement: !ruby/object:Gem::Requirement